Changeset - a321f999a1ea
[Not reviewed]
default
0 1 0
Jason Maltzen - 3 years ago 2021-07-23 07:56:44
jason@hiddenachievement.com
Fix a crash when trying to reorder the reaction list after recording the first reaction in the list.
1 file changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
ViewModels/ExperimentLogViewModel.cs
Show inline comments
...
 
@@ -132,13 +132,16 @@ namespace DesertPaintCodex.ViewModels
 
        #endregion
 

	
 
        private static int ResortTestInList(ReactionTest test, IList<ReactionTest> list)
 
        {
 
            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);
 
            return InsertTestIntoList(test, list);
 
        }
 
        
0 comments (0 inline, 0 general)