Clear the res string before using it

Fix some random timestamps being used as the subtitles text
when the subtitle has actually no text.
This commit is contained in:
Damiano Galassi committed 2026-08-19 16:32:44 +02:00
1 parent ab939411c3
commit 65acfeb7cd
1 file changed
+6 -2
+6 -2
View File
@@ -344,10 +344,14 @@ int LoadSRTFromURL(NSURL *url, MP42SubSerializer *ss, MP4Duration *duration)
state = LINES;
break;
case LINES:
res = @"";
[sc scanUpToString:@"\n\n" intoString:&res];
[sc scanString:@"\n\n" intoString:nil];
MP42SubLine *sl = [[MP42SubLine alloc] initWithLine:res start:startTime end:endTime top_pos:position forced:forced];
[ss addLine:sl];
if (res.length)
{
MP42SubLine *sl = [[MP42SubLine alloc] initWithLine:res start:startTime end:endTime top_pos:position forced:forced];
[ss addLine:sl];
}
state = INITIAL;
break;
};