[Scummvm-git-logs] scummvm master -> f2c630032ca825cf71854a7016f16b598cb90456
neuromancer
noreply at scummvm.org
Sun Dec 4 09:54:01 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f2c630032c FREESCAPE: assertions for potential nullptr derreferences reported by coverity
Commit: f2c630032ca825cf71854a7016f16b598cb90456
https://github.com/scummvm/scummvm/commit/f2c630032ca825cf71854a7016f16b598cb90456
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-04T10:55:00+01:00
Commit Message:
FREESCAPE: assertions for potential nullptr derreferences reported by coverity
Changed paths:
engines/freescape/language/instruction.cpp
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 5cd2ee8de27..cf9c0ab02f4 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -324,6 +324,7 @@ void FreescapeEngine::executeDestroy(FCLInstruction &instruction) {
debugC(1, kFreescapeDebugCode, "Destroying obj %d in area %d!", objectID, areaID);
assert(_areaMap.contains(areaID));
Object *obj = _areaMap[areaID]->objectWithID(objectID);
+ assert(obj); // We know that an object should be there
if (obj->isDestroyed())
debugC(1, kFreescapeDebugCode, "WARNING: Destroying obj %d in area %d already destroyed!", objectID, areaID);
@@ -343,6 +344,7 @@ void FreescapeEngine::executeMakeInvisible(FCLInstruction &instruction) {
debugC(1, kFreescapeDebugCode, "Making obj %d invisible in area %d!", objectID, areaID);
Object *obj = _areaMap[areaID]->objectWithID(objectID);
+ assert(obj); // We assume the object was there
obj->makeInvisible();
}
@@ -359,6 +361,7 @@ void FreescapeEngine::executeMakeVisible(FCLInstruction &instruction) {
debugC(1, kFreescapeDebugCode, "Making obj %d visible in area %d!", objectID, areaID);
Object *obj = _areaMap[areaID]->objectWithID(objectID);
+ assert(obj); // We assume an object should be there
obj->makeVisible();
}
@@ -387,6 +390,7 @@ void FreescapeEngine::executeToggleVisibility(FCLInstruction &instruction) {
// If an object is not in the area, it is considered to be invisible
_currentArea->addObjectFromArea(objectID, _areaMap[255]);
obj = _areaMap[areaID]->objectWithID(objectID);
+ assert(obj); // We know that an object should be there
obj->makeVisible();
}
}
More information about the Scummvm-git-logs
mailing list