1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-17 19:20:49 +00:00

Merge branch 'assert_again' into 'master'

Replace another `assert` with a `throw`

See merge request OpenMW/openmw!3043
This commit is contained in:
psi29a 2023-05-22 09:07:02 +00:00
commit def5839c8d

View File

@ -527,7 +527,10 @@ namespace ESM4
// else the method may try to dereference an element that does not exist
const GroupTypeHeader& Reader::grp(std::size_t pos) const
{
assert(pos <= mCtx.groupStack.size() - 1 && "ESM4::Reader::grp - exceeded stack depth");
if (mCtx.groupStack.size() == 0)
throw std::runtime_error("ESM4::Reader::grp mCtx.groupStack.size is zero");
if (pos <= mCtx.groupStack.size() - 1)
throw std::runtime_error("ESM4::Reader::grp - exceeded stack depth");
return (*(mCtx.groupStack.end() - pos - 1)).first;
}