mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
- fixed: Checking the terrain for any texture that was created after initializing the terrain data either returned random garbage or could even create an access violation. Added a range check to the array access function to prevent this.
This commit is contained in:
parent
1a39ac9243
commit
a5a17e45cf
1 changed files with 2 additions and 0 deletions
|
@ -49,11 +49,13 @@ public:
|
||||||
|
|
||||||
WORD operator [](FTextureID tex) const
|
WORD operator [](FTextureID tex) const
|
||||||
{
|
{
|
||||||
|
if ((unsigned)tex.GetIndex() >= Types.Size()) return DefaultTerrainType;
|
||||||
WORD type = Types[tex.GetIndex()];
|
WORD type = Types[tex.GetIndex()];
|
||||||
return type == 0xffff? DefaultTerrainType : type;
|
return type == 0xffff? DefaultTerrainType : type;
|
||||||
}
|
}
|
||||||
WORD operator [](int texnum) const
|
WORD operator [](int texnum) const
|
||||||
{
|
{
|
||||||
|
if ((unsigned)texnum >= Types.Size()) return DefaultTerrainType;
|
||||||
WORD type = Types[texnum];
|
WORD type = Types[texnum];
|
||||||
return type == 0xffff? DefaultTerrainType : type;
|
return type == 0xffff? DefaultTerrainType : type;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue