Skip to content

Commit

Permalink
Merge remote-tracking branch 'robux4/PushElement_error'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbunkus committed Jan 27, 2024
2 parents a381440 + c101056 commit 0fbab34
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/EbmlMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ filepos_t EbmlMaster::RenderData(IOCallback & output, bool bForceRender, ShouldW
*/
bool EbmlMaster::PushElement(EbmlElement & element)
{
ElementList.push_back(&element);
return true;
try {
ElementList.push_back(&element);
return true;
} catch(...) {
}
return false;
}

std::uint64_t EbmlMaster::UpdateSize(ShouldWrite writeFilter, bool bForceRender)
Expand Down Expand Up @@ -159,7 +163,20 @@ bool EbmlMaster::ProcessMandatory()
for (EltIdx = 0; EltIdx < EBML_CTX_SIZE(MasterContext); EltIdx++) {
if (EBML_CTX_IDX(MasterContext,EltIdx).IsMandatory() && EBML_CTX_IDX(MasterContext,EltIdx).IsUnique()) {
// assert(EBML_CTX_IDX(MasterContext,EltIdx).Create != NULL);
PushElement(EBML_SEM_CREATE(EBML_CTX_IDX(MasterContext,EltIdx)));
if (PushElement(EBML_SEM_CREATE(EBML_CTX_IDX(MasterContext,EltIdx))))
continue;

while (EltIdx-- != 0)
{
if (EBML_CTX_IDX(MasterContext,EltIdx).IsMandatory() && EBML_CTX_IDX(MasterContext,EltIdx).IsUnique())
{
// element that have been pushed should be removed
auto *todelete = ElementList.back();
ElementList.pop_back();
delete todelete;
}
}
return false;
}
}
return true;
Expand Down

0 comments on commit 0fbab34

Please sign in to comment.