diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-06-20 10:30:36 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-06-20 10:30:36 +0100 |
| commit | 2cdecbe2b56233b009f6edfa13033c6ec9d198bf (patch) | |
| tree | b6797e9314b7d6575898cc8cfad2116e46ce3a31 /src/lib | |
| parent | 0444ddab72c195d91e422ac659594e6d81fbf938 (diff) | |
Fix small .srt parsing bug; add a test.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/exceptions.cc | 4 | ||||
| -rw-r--r-- | src/lib/subrip.cc | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/exceptions.cc b/src/lib/exceptions.cc index 4d9ccc95c..f34cebbfe 100644 --- a/src/lib/exceptions.cc +++ b/src/lib/exceptions.cc @@ -63,7 +63,7 @@ PixelFormatError::PixelFormatError (string o, AVPixelFormat f) } SubRipError::SubRipError (string saw, string expecting, boost::filesystem::path f) - : FileError (String::compose (_("Error in SubRip file: saw %1 while expecting %2"), saw, expecting), f) + : FileError (String::compose (_("Error in SubRip file: saw %1 while expecting %2"), saw.empty() ? "[nothing]" : saw, expecting), f) { - + } diff --git a/src/lib/subrip.cc b/src/lib/subrip.cc index 3217a4df0..11ad3302d 100644 --- a/src/lib/subrip.cc +++ b/src/lib/subrip.cc @@ -66,13 +66,18 @@ SubRip::SubRip (shared_ptr<const SubRipContent> content) switch (state) { case COUNTER: { + if (line.empty ()) { + /* a blank line at the start is ok */ + break; + } + int x = 0; try { x = lexical_cast<int> (line); } catch (...) { } - + if (x == next_count) { state = METADATA; ++next_count; |
