Add missing pop() for the failure case of script subsetting.

This commit is contained in:
Garret Rieger 2019-10-16 16:58:57 -07:00
parent eab191fd9c
commit eff91bbb4b
1 changed files with 4 additions and 2 deletions

View File

@ -221,13 +221,15 @@ struct RecordListOf : RecordArrayOf<Type>
unsigned int count = this->len; unsigned int count = this->len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
auto snap = c->serializer->snapshot ();
auto *record = out->serialize_append (c->serializer); auto *record = out->serialize_append (c->serializer);
if (likely(record) && record->offset.serialize_subset (c, this->get_offset (i), this, out, &record_list_context)) if (unlikely (!record)) return false;
auto snap = c->serializer->snapshot ();
if (record->offset.serialize_subset (c, this->get_offset (i), this, out, &record_list_context))
{ {
record->tag = this->get_tag(i); record->tag = this->get_tag(i);
continue; continue;
} }
out->pop ();
c->serializer->revert (snap); c->serializer->revert (snap);
} }