diff --git a/source/core/textures/buildtiles.h b/source/core/textures/buildtiles.h index 6e1bfbc6b..04a423fcc 100644 --- a/source/core/textures/buildtiles.h +++ b/source/core/textures/buildtiles.h @@ -379,8 +379,9 @@ inline bool tileLoad(int tileNum) inline uint8_t* tileData(int num) { - auto tex = TileFiles.tiledata[num].texture; - auto p = dynamic_cast(tex->GetTexture()); + auto tex = dynamic_cast(TileFiles.tiledata[num].texture->GetTexture()); + if (!tex) return nullptr; + auto p = dynamic_cast(tex->GetImage()); return p ? p->GetRawData() : nullptr; }