From 82f4c0277c739c9461bd9d95492fc50df6357528 Mon Sep 17 00:00:00 2001 From: cadaei Date: Tue, 8 Oct 2019 20:08:49 +0200 Subject: [PATCH 1/2] null exception fix --- ARKBreedingStats/BreedingPlan.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ARKBreedingStats/BreedingPlan.cs b/ARKBreedingStats/BreedingPlan.cs index 98c93642..1ded62e0 100644 --- a/ARKBreedingStats/BreedingPlan.cs +++ b/ARKBreedingStats/BreedingPlan.cs @@ -794,7 +794,10 @@ public Species CurrentSpecies private void listViewSpeciesBP_SelectedIndexChanged(object sender, EventArgs e) { if (listViewSpeciesBP.SelectedIndices.Count > 0 - && listViewSpeciesBP.SelectedItems[0].Text != currentSpecies.DescriptiveNameAndMod) + && !string.IsNullOrEmpty(listViewSpeciesBP.SelectedItems[0]?.Text) + && (currentSpecies == null + || listViewSpeciesBP.SelectedItems[0].Text != currentSpecies.DescriptiveNameAndMod) + ) { SetGlobalSpecies?.Invoke((Species)((ListViewItem)listViewSpeciesBP.SelectedItems[0]).Tag); } From fcad741cb0507ed0d4d6147272723713fe00ec1c Mon Sep 17 00:00:00 2001 From: cadaei Date: Tue, 8 Oct 2019 20:15:21 +0200 Subject: [PATCH 2/2] null-fix --- ARKBreedingStats/Form1.collection.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ARKBreedingStats/Form1.collection.cs b/ARKBreedingStats/Form1.collection.cs index 51f38ba3..141dcf8b 100644 --- a/ARKBreedingStats/Form1.collection.cs +++ b/ARKBreedingStats/Form1.collection.cs @@ -431,7 +431,8 @@ private bool LoadCollectionFile(string filePath, bool keepCurrentCreatures = fal || !creatureCollection.creatures.Any(c => c.Species.Equals(selectedlibrarySpecies)) ) selectedlibrarySpecies = speciesSelector1.SelectedSpecies; - listBoxSpeciesLib.SelectedIndex = listBoxSpeciesLib.Items.IndexOf(selectedlibrarySpecies); + if (selectedlibrarySpecies != null) + listBoxSpeciesLib.SelectedIndex = listBoxSpeciesLib.Items.IndexOf(selectedlibrarySpecies); filterListAllowed = true; FilterLib();