From 709b4a409fddc4382ca54f418c48c7a4c5c556bd Mon Sep 17 00:00:00 2001 From: Martchus Date: Mon, 1 Feb 2021 17:10:29 +0100 Subject: [PATCH] Ensure attachments have been parsed before making MKV file --- matroska/matroskacontainer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/matroska/matroskacontainer.cpp b/matroska/matroskacontainer.cpp index 98940ac..ef14482 100644 --- a/matroska/matroskacontainer.cpp +++ b/matroska/matroskacontainer.cpp @@ -851,6 +851,14 @@ void MatroskaContainer::internalMakeFile(Diagnostics &diag, AbortableProgressFee diag.emplace_back(DiagLevel::Critical, "The header has not been parsed yet.", context); throw InvalidDataException(); } + switch (fileInfo().attachmentsParsingStatus()) { + case ParsingStatus::Ok: + case ParsingStatus::NotSupported: + break; + default: + diag.emplace_back(DiagLevel::Critical, "Attachments have to be parsed without critical errors before changes can be applied.", context); + throw InvalidDataException(); + } // define variables for parsing the elements of the original file EbmlElement *level0Element = firstElement();