Skip to content

Commit

Permalink
Fix null ref (#2845)
Browse files Browse the repository at this point in the history
  • Loading branch information
leotsarev authored Oct 16, 2024
1 parent 2301709 commit 5ca65a5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/JoinRpg.WebPortal.Models/Characters/EditCharacterViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public class EditCharacterViewModel : CharacterViewModelBase, ICreatedUpdatedTra
{
public int CharacterId { get; set; }

public CharacterNavigationViewModel Navigation { get; set; }
[ReadOnly(true)]
public CharacterNavigationViewModel Navigation { get; set; } = null!;

[ReadOnly(true)]
public bool IsActive { get; private set; }
Expand Down Expand Up @@ -41,13 +42,20 @@ public EditCharacterViewModel Fill(Character field, int currentUserId, ProjectIn
CreatedBy = field.CreatedBy;
UpdatedBy = field.UpdatedBy;

IsDefaultTemplate = projectInfo.DefaultTemplateCharacter.CharacterId == field.CharacterId;
IsDefaultTemplate = projectInfo.DefaultTemplateCharacter?.CharacterId == field.CharacterId;

return this;
}

[ReadOnly(true)]
public DateTime CreatedAt { get; private set; }
public User CreatedBy { get; private set; }

[ReadOnly(true)]
public User CreatedBy { get; private set; } = null!;

[ReadOnly(true)]
public DateTime UpdatedAt { get; private set; }
public User UpdatedBy { get; private set; }

[ReadOnly(true)]
public User UpdatedBy { get; private set; } = null!;
}

0 comments on commit 5ca65a5

Please sign in to comment.