Fix crash after running Whisper - thx JDTR75 :)

Related to #8755
This commit is contained in:
Nikolaj Olsson 2024-08-28 09:23:10 +02:00
parent b4ae02bf36
commit c3a44b62d5
2 changed files with 9 additions and 1 deletions

View File

@ -77,6 +77,14 @@ namespace Test.Logic
Assert.AreEqual(ms, new TimeSpan(0, 1, 2, 3, 990).TotalMilliseconds);
}
[TestMethod]
public void TimeCodeParseToMilliseconds4()
{
var ms = TimeCode.ParseToMilliseconds("02:03:99");
Assert.AreEqual(ms, new TimeSpan(0, 0, 2, 3, 990).TotalMilliseconds);
}
[TestMethod]
public void TimeCodeGetTotalMilliseconds()
{

View File

@ -36,7 +36,7 @@ namespace Nikse.SubtitleEdit.Core.Common
if (parts.Length == 3)
{
var msString = parts[3].PadRight(2, '0');
var msString = parts[2].PadRight(2, '0');
if (int.TryParse(parts[0], out var minutes) && int.TryParse(parts[1], out var seconds) && int.TryParse(msString, out var milliseconds))
{
return new TimeSpan(0, 0, minutes, seconds, milliseconds).TotalMilliseconds;