From c1788f58a63f6fb17600e92f20727ea9d34275db Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Mon, 18 Dec 2023 09:46:31 +0100 Subject: [PATCH] don't keep null clones This will crash in the destructor and many other places. It's unlikely to happen by better safe than sorry. --- src/EbmlMaster.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/EbmlMaster.cpp b/src/EbmlMaster.cpp index 96b4e693..3e912c6d 100644 --- a/src/EbmlMaster.cpp +++ b/src/EbmlMaster.cpp @@ -61,7 +61,11 @@ EbmlMaster::EbmlMaster(const EbmlMaster & ElementToClone) ElementList.reserve(ElementToClone.ListSize()); // add a clone of the list for (const auto& e : ElementToClone.ElementList) - ElementList.push_back(e->Clone()); + { + auto *clone = e->Clone(); + if (clone != nullptr) + ElementList.push_back(clone); + } } EbmlMaster::~EbmlMaster()