diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-02-08 15:47:28 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-02-08 15:48:00 +0000 |
| commit | 1930126b1f91aea4fc036a95139b6c25e163c83a (patch) | |
| tree | f8256dab49ded2b00b199453ac5f9ea87ea37756 /src | |
| parent | 41e9c324e58bfd2a4cd4a6f1554e8f4b362c8293 (diff) | |
Fix crash with empty SSA subtitle.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ssa_reader.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ssa_reader.cc b/src/ssa_reader.cc index 471931f..b899da6 100644 --- a/src/ssa_reader.cc +++ b/src/ssa_reader.cc @@ -212,9 +212,11 @@ SSAReader::parse_line (RawSubtitle base, string line, int play_res_x, int play_r /* Count the number of line breaks */ int line_breaks = 0; - for (size_t i = 0; i < line.length() - 1; ++i) { - if (line[i] == '\\' && (line[i+1] == 'n' || line[i+1] == 'N')) { - ++line_breaks; + if (line.length() > 1) { + for (size_t i = 0; i < line.length() - 1; ++i) { + if (line[i] == '\\' && (line[i+1] == 'n' || line[i+1] == 'N')) { + ++line_breaks; + } } } |
