summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-02-08 15:47:28 +0000
committerCarl Hetherington <cth@carlh.net>2019-02-08 15:47:28 +0000
commit2591901b9d269681fa622d8fe28d4bf3a9dafaf1 (patch)
tree4e8f0324348fed27a518a195456cddd5d367bcbf /src
parentffadc3ce125137e3b6d85dbf711c1c3bd7d15e53 (diff)
Fix crash with empty SSA subtitle.
Diffstat (limited to 'src')
-rw-r--r--src/ssa_reader.cc8
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;
+ }
}
}