Skip to content

Commit

Permalink
don't keep null clones
Browse files Browse the repository at this point in the history
This will crash in the destructor and many other places.

It's unlikely to happen by better safe than sorry.

(cherry picked from commit ca27cb0) (edited)
  • Loading branch information
robUx4 committed Dec 18, 2023
1 parent 1878e78 commit df6885d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/EbmlMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}
Expand Down

0 comments on commit df6885d

Please sign in to comment.