From 74983641504f9d0610d78e17f1627b246415254e Mon Sep 17 00:00:00 2001 From: John Maxwell Date: Thu, 26 Feb 2026 08:48:53 -0800 Subject: [PATCH] Fix LT-22173: Running 'Delete Entries' utility twice crashes --- .../Lexicon/DeleteEntriesSensesWithoutInterlinearization.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Src/LexText/Lexicon/DeleteEntriesSensesWithoutInterlinearization.cs b/Src/LexText/Lexicon/DeleteEntriesSensesWithoutInterlinearization.cs index bcb72769ce..abfbc3a14b 100644 --- a/Src/LexText/Lexicon/DeleteEntriesSensesWithoutInterlinearization.cs +++ b/Src/LexText/Lexicon/DeleteEntriesSensesWithoutInterlinearization.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2015 SIL International +// Copyright (c) 2015 SIL International // This software is licensed under the LGPL, version 2.1 or later // (http://www.gnu.org/licenses/lgpl-2.1.html) @@ -110,8 +110,8 @@ void DeleteUnusedEntriesAndSenses(LcmCache cache, ProgressBar progressBar) } } - progressBar.Value = 1; progressBar.Maximum = entriesToDel.Count; + progressBar.Value = Math.Min(1, progressBar.Maximum); foreach (var entry in entriesToDel) { progressBar.PerformStep(); @@ -119,8 +119,8 @@ void DeleteUnusedEntriesAndSenses(LcmCache cache, ProgressBar progressBar) } var senses = cache.ServiceLocator.GetInstance().AllInstances().ToArray(); - progressBar.Value = 1; progressBar.Maximum = senses.Length; + progressBar.Value = Math.Min(1, progressBar.Maximum); foreach (var sense in senses) { progressBar.PerformStep();