From df6885d34204b9450a09f0ccbc31c492784157e4 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. (cherry picked from commit ca27cb05f1955a4b8db35edd5935eec613684aae) (edited) --- src/EbmlMaster.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/EbmlMaster.cpp b/src/EbmlMaster.cpp index 071eb5dc..b224a458 100644 --- a/src/EbmlMaster.cpp +++ b/src/EbmlMaster.cpp @@ -64,8 +64,13 @@ EbmlMaster::EbmlMaster(const EbmlMaster & ElementToClone) auto myItr = ElementList.begin(); while (Itr != ElementToClone.ElementList.end()) { - *myItr = (*Itr)->Clone(); - ++Itr; ++myItr; + auto *clone = (*Itr)->Clone(); + if (clone != nullptr) + { + *myItr = clone; + ++myItr; + } + ++Itr; } }