1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-16 06:15:02 -05:00

* better handling of illegal formats

This commit is contained in:
Reinhard Pointner 2009-07-03 10:20:51 +00:00
parent f897837811
commit 978cbe881d

View File

@ -29,11 +29,16 @@ public class SubRipReader extends SubtitleReader {
protected SubtitleElement readNext() throws Exception { protected SubtitleElement readNext() throws Exception {
String number = scanner.nextLine(); String number = scanner.nextLine();
// ignore illegal lines
if (!number.matches("\\d+")) if (!number.matches("\\d+"))
return null; return null;
String[] interval = scanner.nextLine().split("-->", 2); String[] interval = scanner.nextLine().split("-->", 2);
// ignore illegal lines
if (interval.length < 2)
return null;
long t1 = timeFormat.parse(interval[0].trim()).getTime(); long t1 = timeFormat.parse(interval[0].trim()).getTime();
long t2 = timeFormat.parse(interval[1].trim()).getTime(); long t2 = timeFormat.parse(interval[1].trim()).getTime();