Skip to content

Commit

Permalink
null check
Browse files Browse the repository at this point in the history
  • Loading branch information
cadaei committed Mar 17, 2020
1 parent 69e75ee commit 7eb679a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ARKBreedingStats/uiControls/NamePatterns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public static Dictionary<string, string> CreateTokenDictionary(Creature creature
string firstWordOfOldest = "";
if (speciesCreatures.Any())
{
firstWordOfOldest = speciesCreatures.Where(c => c.addedToLibrary != null && !c.flags.HasFlag(CreatureFlags.Placeholder)).OrderBy(c => c.addedToLibrary).First().name;
firstWordOfOldest = speciesCreatures.Where(c => c.addedToLibrary != null && !c.flags.HasFlag(CreatureFlags.Placeholder)).OrderBy(c => c.addedToLibrary).FirstOrDefault()?.name;
if (!string.IsNullOrEmpty(firstWordOfOldest) && firstWordOfOldest.Contains(" "))
{
firstWordOfOldest = firstWordOfOldest.Substring(0, firstWordOfOldest.IndexOf(" "));
Expand Down

0 comments on commit 7eb679a

Please sign in to comment.