mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-04 02:41:19 +00:00
Avoid UB on empty fog data record
This commit is contained in:
parent
d846a9fc15
commit
959de6f4c1
@ -69,9 +69,9 @@ namespace ESM
|
||||
esm.getT(tex.mX);
|
||||
esm.getT(tex.mY);
|
||||
|
||||
size_t imageSize = esm.getSubSize() - sizeof(int) * 2;
|
||||
const std::size_t imageSize = esm.getSubSize() - sizeof(int) * 2;
|
||||
tex.mImageData.resize(imageSize);
|
||||
esm.getExact(&tex.mImageData[0], imageSize);
|
||||
esm.getExact(tex.mImageData.data(), imageSize);
|
||||
|
||||
if (dataFormat <= MaxOldForOfWarFormatVersion)
|
||||
convertFogOfWar(tex.mImageData);
|
||||
@ -92,7 +92,7 @@ namespace ESM
|
||||
esm.startSubRecord("FTEX");
|
||||
esm.writeT(it->mX);
|
||||
esm.writeT(it->mY);
|
||||
esm.write(&it->mImageData[0], it->mImageData.size());
|
||||
esm.write(it->mImageData.data(), it->mImageData.size());
|
||||
esm.endRecord("FTEX");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user