Check for valid icon index, fixes crash with original wc2 using expansion units
This commit is contained in:
parent
f7372db5f7
commit
0d896cb45e
1 changed files with 6 additions and 1 deletions
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
/**@name icons.c - The icons. */
|
||||
//
|
||||
// (c) Copyright 1998-2002 by Lutz Sammer
|
||||
// (c) Copyright 1998-2003 by Lutz Sammer
|
||||
//
|
||||
// FreeCraft is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
|
@ -213,6 +213,11 @@ global void LoadIcons(void)
|
|||
#endif
|
||||
}
|
||||
icon->Sprite = icon->File->Sprite;
|
||||
if (icon->Index >= (unsigned)icon->Sprite->NumFrames) {
|
||||
DebugLevel0Fn("Invalid icon index: %s - %d\n"
|
||||
_C_ icon->Ident _C_ icon->Index);
|
||||
icon->Index = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue