Avoid null references on game edit/add page
This commit is contained in:
parent
5b7bd5140c
commit
285cb07e37
5 changed files with 18 additions and 0 deletions
|
@ -60,6 +60,9 @@
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
if (Game.Actions == null)
|
||||||
|
Game.Actions = new List<Data.Models.Action>();
|
||||||
|
|
||||||
OrderedActions = Game.Actions.OrderBy(a => a.SortOrder).ToList();
|
OrderedActions = Game.Actions.OrderBy(a => a.SortOrder).ToList();
|
||||||
FixSortOrder();
|
FixSortOrder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,9 @@
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
if (Game.Archives == null)
|
||||||
|
Game.Archives = new List<Archive>();
|
||||||
|
|
||||||
HttpClient.BaseAddress = new Uri(Navigator.BaseUri);
|
HttpClient.BaseAddress = new Uri(Navigator.BaseUri);
|
||||||
|
|
||||||
Archive = new Archive()
|
Archive = new Archive()
|
||||||
|
|
|
@ -78,6 +78,9 @@
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
if (Game.Keys == null)
|
||||||
|
Game.Keys = new List<Key>();
|
||||||
|
|
||||||
AllocatedKeys = Game.Keys.Count(k => k.IsAllocated());
|
AllocatedKeys = Game.Keys.Count(k => k.IsAllocated());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,12 @@
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public Game Game { get; set; }
|
[Parameter] public Game Game { get; set; }
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
if (Game.MultiplayerModes == null)
|
||||||
|
Game.MultiplayerModes = new List<MultiplayerMode>();
|
||||||
|
}
|
||||||
|
|
||||||
private void AddMode()
|
private void AddMode()
|
||||||
{
|
{
|
||||||
if (Game.MultiplayerModes == null)
|
if (Game.MultiplayerModes == null)
|
||||||
|
|
|
@ -110,6 +110,9 @@
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
if (Game.Scripts == null)
|
||||||
|
Game.Scripts = new List<Script>();
|
||||||
|
|
||||||
Snippets = ScriptService.GetSnippets();
|
Snippets = ScriptService.GetSnippets();
|
||||||
|
|
||||||
if (Script == null)
|
if (Script == null)
|
||||||
|
|
Loading…
Add table
Reference in a new issue