Skip to content

Commit 2c9650d

Browse files
authored
#620 - Fix crash loading game setup dialog
1 parent f355351 commit 2c9650d

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

FrEee.Core.Domain/Extensions/GameEnumerableExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static T FindByModID<T>(this IEnumerable<T> items, string modID)
6363
return result;
6464
}
6565

66-
public static T FindByName<T>(this IEnumerable<T> stuff, string name) where T : INamed
66+
public static T? FindByName<T>(this IEnumerable<T> stuff, string? name) where T : INamed
6767
{
6868
return stuff.FirstOrDefault(item => item.Name == name);
6969
}

FrEee.Core.Domain/Processes/Setup/GameSetup.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,13 @@ public GameSetup()
8080
/// The galaxy template to use.
8181
/// </summary>
8282
[DoNotSerialize]
83-
public GalaxyTemplate GalaxyTemplate
83+
public GalaxyTemplate? GalaxyTemplate
8484
{
85-
get { return Mod.Current.GalaxyTemplates.FindByName(GalaxyTemplateName); }
86-
set { GalaxyTemplateName = value.Name; }
85+
get => Mod.Current.GalaxyTemplates.FindByName(GalaxyTemplateName);
86+
set => GalaxyTemplateName = value?.Name;
8787
}
8888

89-
public string GalaxyTemplateName
90-
{
91-
get;
92-
private set;
93-
}
89+
public string? GalaxyTemplateName { get; private set; }
9490

9591
/// <summary>
9692
/// The name of the game. Used in save file names.

0 commit comments

Comments
 (0)