# HG changeset patch # User Jason Maltzen # Date 2021-07-23 07:56:44 # Node ID a321f999a1ea05176ba74f610824680c467e2e97 # Parent 9f255f7e44228ecc551cf957b325d7a2c2beb08d Fix a crash when trying to reorder the reaction list after recording the first reaction in the list. diff --git a/ViewModels/ExperimentLogViewModel.cs b/ViewModels/ExperimentLogViewModel.cs --- a/ViewModels/ExperimentLogViewModel.cs +++ b/ViewModels/ExperimentLogViewModel.cs @@ -135,7 +135,10 @@ namespace DesertPaintCodex.ViewModels { int oldPos = list.IndexOf(test); - if (((oldPos > 0) || (test.CompareTo(list[oldPos - 1]) > 0)) + // If the item is first in the list or the previous item is valued < the test + // And either the item is last in the list or the next item in the list is valued > than the item + // Don't move it + if (((oldPos == 0) || (test.CompareTo(list[oldPos - 1]) > 0)) && ((oldPos == list.Count - 1) || (test.CompareTo(list[oldPos + 1]) < 0))) return oldPos; // No need to move. list.RemoveAt(oldPos);