mirror of https://github.com/OpenTTD/OpenTTD
(svn r1882) Add a basic check if a non-existent sprite gets accessed.
Now ottd bails out with an error message instead of segfaulting. This is far from perfect, some checks after loading a savegame should be added.release/0.4.5
parent
fe6f9e9a65
commit
f7991303e8
|
@ -154,6 +154,14 @@ static void ReadSprite(SpriteID id, void *buffer)
|
||||||
byte type;
|
byte type;
|
||||||
byte* dest;
|
byte* dest;
|
||||||
|
|
||||||
|
if (_sprite_file_pos[id] == 0) {
|
||||||
|
error(
|
||||||
|
"Tried to load non-existing sprite #%d.\n"
|
||||||
|
"Probable cause: Wrong/missing NewGRFs",
|
||||||
|
id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
FioSeekToFile(_sprite_file_pos[id]);
|
FioSeekToFile(_sprite_file_pos[id]);
|
||||||
|
|
||||||
type = FioReadByte();
|
type = FioReadByte();
|
||||||
|
|
Loading…
Reference in New Issue