mirror of https://github.com/OpenTTD/OpenTTD.git
(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.
This commit is contained in:
parent
fe6f9e9a65
commit
f7991303e8
|
@ -154,6 +154,14 @@ static void ReadSprite(SpriteID id, void *buffer)
|
|||
byte type;
|
||||
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]);
|
||||
|
||||
type = FioReadByte();
|
||||
|
|
Loading…
Reference in New Issue