aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/screen_item32.cpp
diff options
context:
space:
mode:
authorColin Snover2016-05-27 18:59:12 -0500
committerColin Snover2016-05-27 19:20:22 -0500
commit371b50e75abec89ed182a72599d96b645711bbc8 (patch)
treed69d2ae4c15b460e22d1979d884fbec25c39e577 /engines/sci/graphics/screen_item32.cpp
parent4840b889d7c8d2924f162c270d85c5431f0f86a6 (diff)
downloadscummvm-rg350-371b50e75abec89ed182a72599d96b645711bbc8.tar.gz
scummvm-rg350-371b50e75abec89ed182a72599d96b645711bbc8.tar.bz2
scummvm-rg350-371b50e75abec89ed182a72599d96b645711bbc8.zip
SCI32: Add explicit checks for null pointers
CID 1351617, 1351618, 1351619, 1351620, 1351621, 1351622, 1354791.
Diffstat (limited to 'engines/sci/graphics/screen_item32.cpp')
-rw-r--r--engines/sci/graphics/screen_item32.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/engines/sci/graphics/screen_item32.cpp b/engines/sci/graphics/screen_item32.cpp
index 953091470f..fba0fa0422 100644
--- a/engines/sci/graphics/screen_item32.cpp
+++ b/engines/sci/graphics/screen_item32.cpp
@@ -326,6 +326,9 @@ void ScreenItem::calcRects(const Plane &plane) {
mulinc(temp, celToScreenX, Ratio());
CelObjPic *celObjPic = dynamic_cast<CelObjPic *>(_celObj);
+ if (celObjPic == nullptr) {
+ error("Expected a CelObjPic");
+ }
temp.translate((celObjPic->_relativePosition.x * scriptToScreenX).toInt() - displaceX, 0);
// TODO: This is weird.
@@ -369,6 +372,9 @@ void ScreenItem::calcRects(const Plane &plane) {
}
CelObjPic *celObjPic = dynamic_cast<CelObjPic *>(_celObj);
+ if (celObjPic == nullptr) {
+ error("Expected a CelObjPic");
+ }
temp.translate(celObjPic->_relativePosition.x - (displaceX * scaleX).toInt(), celObjPic->_relativePosition.y - (celObj._displace.y * scaleY).toInt());
// TODO: This is weird.