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:
1 file changed
+6
-2
@@ -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;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user