From 7eb679aa40af42dee740e00032e6fe1762a4a83c Mon Sep 17 00:00:00 2001 From: cadaei Date: Tue, 17 Mar 2020 21:48:45 +0100 Subject: [PATCH] null check --- ARKBreedingStats/uiControls/NamePatterns.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ARKBreedingStats/uiControls/NamePatterns.cs b/ARKBreedingStats/uiControls/NamePatterns.cs index 8815fc6f..5d79acf7 100644 --- a/ARKBreedingStats/uiControls/NamePatterns.cs +++ b/ARKBreedingStats/uiControls/NamePatterns.cs @@ -336,7 +336,7 @@ public static Dictionary 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(" "));