summaryrefslogtreecommitdiff
path: root/src/lib/subtitle_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-02 21:14:24 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-02 21:14:24 +0100
commitca436a8e96e02f982790d4168ac3dfe1d589451c (patch)
tree6f3ee681e03c2633b48fedb3e11b5ce2fadbaa06 /src/lib/subtitle_content.cc
parent6f68971e81a9b16973b3784f2f3f93f42ceb2af1 (diff)
Fix crash when loading old state files.
Diffstat (limited to 'src/lib/subtitle_content.cc')
-rw-r--r--src/lib/subtitle_content.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/subtitle_content.cc b/src/lib/subtitle_content.cc
index a45b0a24f..5b3b453b6 100644
--- a/src/lib/subtitle_content.cc
+++ b/src/lib/subtitle_content.cc
@@ -69,6 +69,17 @@ SubtitleContent::SubtitleContent (Content* parent)
shared_ptr<SubtitleContent>
SubtitleContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version)
{
+ if (version < 34) {
+ /* With old metadata FFmpeg content has the subtitle-related tags even with no
+ subtitle streams, so check for that.
+ */
+ if (node->string_child("Type") == "FFmpeg" && node->node_children("SubtitleStream").empty()) {
+ return shared_ptr<SubtitleContent> ();
+ }
+
+ /* Otherwise we can drop through to the newer logic */
+ }
+
if (!node->optional_number_child<double>("SubtitleXOffset") && !node->optional_number_child<double>("SubtitleOffset")) {
return shared_ptr<SubtitleContent> ();
}