Skip to content

Commit

Permalink
Fix incorrect breaking behavior in PGS
Browse files Browse the repository at this point in the history
Fixes #30

Signed-off-by: Ethan Dye <mrtops03@gmail.com>
  • Loading branch information
ecdye committed Oct 27, 2024
1 parent a8977ed commit 1586a4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/macSubtitleOCR/Subtitles/PGS/PGS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct PGS {
ods = try ODS(buffer, offset, segmentLength)
offset += segmentLength
hasMultipleODS = true
break
continue
} else if hasMultipleODS {
try ods!.appendSegment(buffer, offset, segmentLength)
offset += segmentLength
Expand All @@ -99,14 +99,14 @@ struct PGS {
} catch let macSubtitleOCRError.invalidODSDataLength(length) {
logger.error("Invalid ODS length: \(length), abandoning remaining segments!")
offset = buffer.count
return nil
continue
}
case 0x16, 0x17:
offset += segmentLength
default:
logger.warning("Unknown segment type: \(segmentType.hex()), skipping...")
offset += segmentLength
return nil
continue
}

guard let pds, let ods else { continue }
Expand Down

0 comments on commit 1586a4d

Please sign in to comment.