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:47:28 +0000 |
| commit | 2591901b9d269681fa622d8fe28d4bf3a9dafaf1 (patch) | |
| tree | 4e8f0324348fed27a518a195456cddd5d367bcbf /src | |
| parent | ffadc3ce125137e3b6d85dbf711c1c3bd7d15e53 (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; + } } } |
