mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-01 18:39:42 +00:00
Merge branch 'fix_empty_vector' into 'master'
Guard an undefined behaviour Closes #6725 See merge request OpenMW/openmw!3037
This commit is contained in:
commit
e1754b840a
1 changed files with 3 additions and 0 deletions
|
@ -78,6 +78,9 @@ void ESM4::Header::load(ESM4::Reader& reader)
|
||||||
}
|
}
|
||||||
case ESM4::SUB_DATA:
|
case ESM4::SUB_DATA:
|
||||||
{
|
{
|
||||||
|
if (mMaster.empty())
|
||||||
|
throw std::runtime_error(
|
||||||
|
"Failed to read TES4 DATA subrecord: there is no preceding MAST subrecord");
|
||||||
// WARNING: assumes DATA always follows MAST
|
// WARNING: assumes DATA always follows MAST
|
||||||
if (!reader.getExact(mMaster.back().size))
|
if (!reader.getExact(mMaster.back().size))
|
||||||
throw std::runtime_error("TES4 DATA data read error");
|
throw std::runtime_error("TES4 DATA data read error");
|
||||||
|
|
Loading…
Reference in a new issue