aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2016-09-12 21:19:52 +0200
committerStrangerke2016-09-12 21:19:52 +0200
commitdb3ba8ecc03052a463e3f4d757c3efd4cb604994 (patch)
treea363a72cd5bec56199897cdd45197ec2a231a5c7
parent2aada126a254628a3eda6d14788bb6131fe41985 (diff)
downloadscummvm-rg350-db3ba8ecc03052a463e3f4d757c3efd4cb604994.tar.gz
scummvm-rg350-db3ba8ecc03052a463e3f4d757c3efd4cb604994.tar.bz2
scummvm-rg350-db3ba8ecc03052a463e3f4d757c3efd4cb604994.zip
DM: Avoid null pointer dereferencing in unlinkThingFromList
-rw-r--r--engines/dm/dungeonman.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index 4e7dd9d8cd..74979850ef 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -1584,7 +1584,8 @@ void DungeonMan::unlinkThingFromList(Thing thingToUnlink, Thing thingInList, int
Thing currThing = getNextThing(thingInList);
while (currThing.getTypeAndIndex() != thingToUnlink.toUint16()) {
if ((currThing == Thing::_endOfList) || (currThing == Thing::_none)) {
- *thingPtr = Thing::_endOfList;
+ if (thingPtr)
+ *thingPtr = Thing::_endOfList;
return;
}
currThing = getNextThing(thingInList = currThing);