* better handling of illegal formats

This commit is contained in:
Reinhard Pointner 2009-07-03 10:20:51 +00:00
parent f897837811
commit 978cbe881d
1 changed files with 5 additions and 0 deletions

View File

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