mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-24 04:43:49 +00:00
Guard an undefined behaviour
`std::vector.back()` on an empty `std::vector` is undefined. This should fix #6725. Thanks to @Capostrophic for the investigation.
This commit is contained in:
parent
5b36ea0179
commit
81bd034a9e
@ -78,6 +78,9 @@ void ESM4::Header::load(ESM4::Reader& reader)
|
||||
}
|
||||
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
|
||||
if (!reader.getExact(mMaster.back().size))
|
||||
throw std::runtime_error("TES4 DATA data read error");
|
||||
|
Loading…
x
Reference in New Issue
Block a user