mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Fix crash with array out of bounds when refNum index is incorrect.
This commit is contained in:
parent
2c9bf343ac
commit
5fd107a95c
1 changed files with 4 additions and 2 deletions
|
@ -18,9 +18,11 @@ namespace
|
||||||
///< Translate 8bit/24bit code (stored in refNum.mIndex) into a proper refNum
|
///< Translate 8bit/24bit code (stored in refNum.mIndex) into a proper refNum
|
||||||
void adjustRefNum (ESM::RefNum& refNum, ESM::ESMReader& reader)
|
void adjustRefNum (ESM::RefNum& refNum, ESM::ESMReader& reader)
|
||||||
{
|
{
|
||||||
int local = (refNum.mIndex & 0xff000000) >> 24;
|
unsigned int local = (refNum.mIndex & 0xff000000) >> 24;
|
||||||
|
|
||||||
if (local)
|
// If we have an index value that does not make sense, assume that it was an addition
|
||||||
|
// by the present plugin (but a faulty one)
|
||||||
|
if (local && local <= reader.getGameFiles().size())
|
||||||
{
|
{
|
||||||
// If the most significant 8 bits are used, then this reference already exists.
|
// If the most significant 8 bits are used, then this reference already exists.
|
||||||
// In this case, do not spawn a new reference, but overwrite the old one.
|
// In this case, do not spawn a new reference, but overwrite the old one.
|
||||||
|
|
Loading…
Reference in a new issue