diff options
author | Filippos Karapetis | 2014-05-16 06:26:11 +0300 |
---|---|---|
committer | Filippos Karapetis | 2014-05-16 06:26:11 +0300 |
commit | 4cf895ad062a5ded60ea5dc57991d6ba6941e46e (patch) | |
tree | 2f68c8fd411d788ec74c53f85b9ffd11ec4e0d86 /engines/mads | |
parent | f9fe18c5063611f6e7ec727157efb5a34e69bd56 (diff) | |
download | scummvm-rg350-4cf895ad062a5ded60ea5dc57991d6ba6941e46e.tar.gz scummvm-rg350-4cf895ad062a5ded60ea5dc57991d6ba6941e46e.tar.bz2 scummvm-rg350-4cf895ad062a5ded60ea5dc57991d6ba6941e46e.zip |
MADS: Do not attempt to remove objects that aren't in the inventory
Fixes a crash when the guards take Rex's stuff
Diffstat (limited to 'engines/mads')
-rw-r--r-- | engines/mads/inventory.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index d41a55fe47..79a8e87b2a 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -161,6 +161,10 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { invIndex = idx; } + // If the object isn't in the player's inventory, stop here + if (invIndex < 0) + return; + int selectedIndex = userInterface._selectedInvIndex; bool noSelection = selectedIndex < 0; |