mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Fix crash related to #6829 - thx lolipopsz :)
This commit is contained in:
parent
3395af7fa3
commit
87f6ed1fb0
@ -328,5 +328,21 @@ namespace Test.Core
|
||||
var res = input.ToggleCasing();
|
||||
Assert.AreEqual("how are you", res);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ToggleCasingWithFont()
|
||||
{
|
||||
var input = "<font color=\"Red\">HOW ARE YOU</font>";
|
||||
var res = input.ToggleCasing();
|
||||
Assert.AreEqual("<font color=\"Red\">how are you</font>", res);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ToggleCasingAssa()
|
||||
{
|
||||
var input = "{\\i1}This is an example…{\\i0}";
|
||||
var res = input.ToggleCasing();
|
||||
Assert.AreEqual("{\\i1}THIS IS AN EXAMPLE…{\\i0}", res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -546,7 +546,14 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
for (var index = tags.Count - 1; index >= 0; index--)
|
||||
{
|
||||
var keyValuePair = tags[index];
|
||||
s = s.Insert(keyValuePair.Key, keyValuePair.Value);
|
||||
if (keyValuePair.Key >= s.Length)
|
||||
{
|
||||
s += keyValuePair.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = s.Insert(keyValuePair.Key, keyValuePair.Value);
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
|
Loading…
Reference in New Issue
Block a user