From 2b7ee2292c3a296cd17555887e3452fc8de63b7f Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Fri, 18 Jun 2021 22:38:08 +0100 Subject: [PATCH] fix zero length string replace --- src/libse/Common/ContinuationUtilities.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libse/Common/ContinuationUtilities.cs b/src/libse/Common/ContinuationUtilities.cs index 2658d012d..5155671ae 100644 --- a/src/libse/Common/ContinuationUtilities.cs +++ b/src/libse/Common/ContinuationUtilities.cs @@ -670,7 +670,7 @@ namespace Nikse.SubtitleEdit.Core.Common } newFirstWord = newFirstWord.Trim(); - string result; + string result = null; // If we can find it... if (originalText.IndexOf(firstWord, StringComparison.Ordinal) >= 0) @@ -678,7 +678,7 @@ namespace Nikse.SubtitleEdit.Core.Common // Replace it result = ReplaceFirstOccurrence(originalText, firstWord, newFirstWord); } - else + else if (newFirstWord.Length > 0) { // Just remove whatever prefix we need to remove var prefix = firstWord.Replace(newFirstWord, "");