diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-12-22 19:37:12 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-12-22 19:37:17 +0100 |
| commit | f06acc5d2b9fa65639788fb011c3ada104400083 (patch) | |
| tree | 155fd62e8a5dbe45367264887171473d24cdcb2f /src/ssa_reader.cc | |
| parent | 42ff0632f46a8b1918f16035baa67972eb221282 (diff) | |
Make SSA reader more tolerant of missing styles (DoM #2685).v1.6.45
Diffstat (limited to 'src/ssa_reader.cc')
| -rw-r--r-- | src/ssa_reader.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ssa_reader.cc b/src/ssa_reader.cc index dad0f26..416d317 100644 --- a/src/ssa_reader.cc +++ b/src/ssa_reader.cc @@ -488,8 +488,16 @@ SSAReader::read (function<optional<string> ()> get_line) "they seem to mean literally nothing". Go figure... */ trim_left_if (event[i], boost::is_any_of ("*")); - SUB_ASSERT (styles.find(event[i]) != styles.end()); - style = styles[event[i]]; + /* Use the specified style unless it's not defined, in which case use + * "Default" (if it exists). + */ + if (styles.find(event[i]) != styles.end()) { + style = styles[event[i]]; + } else if (styles.find("Default") != styles.end()) { + style = styles["Default"]; + } else { + continue; + } sub.font = style->font_name; sub.font_size = FontSize::from_proportional(static_cast<float>(style->font_size) / play_res_y); sub.colour = style->primary_colour; |
