fix zero length string replace

This commit is contained in:
Ivandro Jao 2021-06-18 22:38:08 +01:00
parent 7d3ecd76ef
commit 2b7ee2292c

View File

@ -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, "");