From dfdb2aa2ab1dd5f9f63a1bc1f5a25ffebb739c9c Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sat, 20 Jul 2024 17:24:06 +0200 Subject: [PATCH] Fix crash in "Fix common errors" - thx Hardstylest :) Fix #8651 --- Changelog.txt | 3 ++- src/Test/Logic/ContinuationUtilitiesTest.cs | 8 ++++++++ src/libse/Common/ContinuationUtilities.cs | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index d96ebd1a9..dde22148e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -17,7 +17,8 @@ * Fix Romanian translation version number - thx MediaExpres * Fix UI burn-in window spacing/width/height - thx Hafran420 * Fix crash in "Whisper Audio to text" if no audio - thx morrellaberdeen - * Fix running "Faster-Whisper-XXL" without "Faster-Whisper" - thx shanedk + * Fix running "Faster-Whisper-XXL" without "Faster-Whisper" - thx shanedk + * Fix crash in "Fix common errors" - thx Hardstylest 4.0.7 (8th July 2024) diff --git a/src/Test/Logic/ContinuationUtilitiesTest.cs b/src/Test/Logic/ContinuationUtilitiesTest.cs index 1dc8244d7..b34cc10ba 100644 --- a/src/Test/Logic/ContinuationUtilitiesTest.cs +++ b/src/Test/Logic/ContinuationUtilitiesTest.cs @@ -1622,6 +1622,14 @@ namespace Test.Logic Assert.IsTrue(line1Actual); } + [TestMethod] + public void IsItalic14() + { + var line1 = "liebe ♫ ♫ Bevor es zu spät ist ♫ ♫ Das, was"; + var line1Actual = ContinuationUtilities.IsItalic(line1); + Assert.IsFalse(line1Actual); + } + [TestMethod] public void HasPrefix1() { diff --git a/src/libse/Common/ContinuationUtilities.cs b/src/libse/Common/ContinuationUtilities.cs index 34e1bbf0a..7060be462 100644 --- a/src/libse/Common/ContinuationUtilities.cs +++ b/src/libse/Common/ContinuationUtilities.cs @@ -839,7 +839,7 @@ namespace Nikse.SubtitleEdit.Core.Common while (input.IndexOf("", StringComparison.Ordinal) >= 0) { var startIndex = input.IndexOf("", StringComparison.Ordinal); - var endIndex = input.IndexOf("", StringComparison.Ordinal); + var endIndex = input.IndexOf("", startIndex, StringComparison.Ordinal); var textToRemove = endIndex >= 0 ? input.Substring(startIndex, (endIndex + 4) - startIndex) : input.Substring(startIndex); input = input.Replace(textToRemove, string.Empty); }