From a490df0f7e9dbb06830b74c1c01a1b8b4c8c727b Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Sun, 15 May 2022 11:10:37 -0600 Subject: [PATCH] Fix possible index range error --- Source/LibationWinForms/ProcessQueue/ProcessQueueControl.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.cs b/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.cs index d8b5db76..b0fa7aa3 100644 --- a/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.cs +++ b/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.cs @@ -318,14 +318,16 @@ namespace LibationWinForms.ProcessQueue else if (buttonName == nameof(panelClicked.moveUpBtn)) { Queue.MoveQueuePosition(item, QueuePosition.OneUp); - UpdateControl(queueIndex - 1); UpdateControl(queueIndex); + if (queueIndex > 0) + UpdateControl(queueIndex - 1); } else if (buttonName == nameof(panelClicked.moveDownBtn)) { Queue.MoveQueuePosition(item, QueuePosition.OneDown); - UpdateControl(queueIndex + 1); UpdateControl(queueIndex); + if (queueIndex + 1 < Queue.Count) + UpdateControl(queueIndex + 1); } else if (buttonName == nameof(panelClicked.moveLastBtn)) {