aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mads/inventory.cpp4
-rw-r--r--engines/mads/nebular/game_nebular.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp
index abd281dcc8..a6459c764b 100644
--- a/engines/mads/inventory.cpp
+++ b/engines/mads/inventory.cpp
@@ -108,11 +108,11 @@ void InventoryObjects::setRoom(int objectId, int sceneNumber) {
}
bool InventoryObjects::isInRoom(int objectId) const {
- return (*this)[objectId]._roomNumber == _vm->_game->_scene._currentSceneId;
+ return objectId >= 0 && (*this)[objectId]._roomNumber == _vm->_game->_scene._currentSceneId;
}
bool InventoryObjects::isInInventory(int objectId) const {
- return (*this)[objectId]._roomNumber == PLAYER_INVENTORY;
+ return objectId >= 0 && (*this)[objectId]._roomNumber == PLAYER_INVENTORY;
}
void InventoryObjects::addToInventory(int objectId) {
diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp
index b36de8f378..34eb6f140c 100644
--- a/engines/mads/nebular/game_nebular.cpp
+++ b/engines/mads/nebular/game_nebular.cpp
@@ -619,7 +619,7 @@ void GameNebular::unhandledAction() {
_vm->_dialogs->show(0x15);
} else if (action.isAction(VERB_TAKE)) {
int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId);
- if (objId >= 0 && _vm->_game->_objects.isInInventory(objId))
+ if (_vm->_game->_objects.isInInventory(objId))
_vm->_dialogs->show(0x10);
else if (randVal <= 333)
_vm->_dialogs->show(0x8);