From 65acfeb7cdb5dadb661ce5be685e2f9d3904ef1a Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Wed, 19 Aug 2026 16:32:44 +0200 Subject: [PATCH] Clear the res string before using it Fix some random timestamps being used as the subtitles text when the subtitle has actually no text. --- MP42/MP42SubUtilities.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MP42/MP42SubUtilities.m b/MP42/MP42SubUtilities.m index 670c4d3..7fe796b 100644 --- a/MP42/MP42SubUtilities.m +++ b/MP42/MP42SubUtilities.m @@ -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; };