mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-04 16:26:53 +00:00
WAGE: Do something when player is not defined instead of crashes
This commit is contained in:
parent
7cf83cab6a
commit
265fc48d15
@ -209,6 +209,10 @@ void Gui::regenWeaponsMenu() {
|
||||
_menu->clearSubMenu(_weaponsMenuId);
|
||||
|
||||
Chr *player = _engine->_world->_player;
|
||||
if (!player) {
|
||||
warning("regenWeaponsMenu: player is not defined");
|
||||
return;
|
||||
}
|
||||
ObjArray *weapons = player->getWeapons(true);
|
||||
|
||||
bool empty = true;
|
||||
|
@ -252,11 +252,25 @@ bool World::loadWorld(Common::MacResManager *resMan) {
|
||||
Chr *chr = new Chr(resMan->getResName(MKTAG('A','C','H','R'), *iter), res);
|
||||
chr->_resourceId = *iter;
|
||||
addChr(chr);
|
||||
// TODO: What if there's more than one player character?
|
||||
if (chr->_playerCharacter)
|
||||
|
||||
if (chr->_playerCharacter) {
|
||||
if (_player)
|
||||
warning("loadWorld: Player is redefined");
|
||||
|
||||
_player = chr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_player) {
|
||||
warning("loadWorld: Player is not defined");
|
||||
|
||||
if (_chrs.empty()) {
|
||||
error("loadWorld: and I have no characters");
|
||||
}
|
||||
_player = _chrs[0];
|
||||
}
|
||||
|
||||
|
||||
// Load Sounds
|
||||
resArray = resMan->getResIDArray(MKTAG('A','S','N','D'));
|
||||
debug(3, "Loading %d sounds", resArray.size());
|
||||
|
Loading…
Reference in New Issue
Block a user