aboutsummaryrefslogtreecommitdiff
path: root/engines/draci
diff options
context:
space:
mode:
authorEugene Sandulenko2013-10-17 14:01:49 +0300
committerEugene Sandulenko2013-10-17 14:01:49 +0300
commit54ebfe7dded15261e7cb14f3bc234d8eb4feddae (patch)
tree15682f8ecb9b338b5f77681b279e4d4694de6f96 /engines/draci
parent208cd2cf954b9da81945621ddab8489ab4620b96 (diff)
downloadscummvm-rg350-54ebfe7dded15261e7cb14f3bc234d8eb4feddae.tar.gz
scummvm-rg350-54ebfe7dded15261e7cb14f3bc234d8eb4feddae.tar.bz2
scummvm-rg350-54ebfe7dded15261e7cb14f3bc234d8eb4feddae.zip
DRACI: Fix potential division by zero. CID 1003841
Diffstat (limited to 'engines/draci')
-rw-r--r--engines/draci/walking.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp
index f1ae769d80..195b968860 100644
--- a/engines/draci/walking.cpp
+++ b/engines/draci/walking.cpp
@@ -556,9 +556,15 @@ bool WalkingState::alignHeroToEdge(const Common::Point &p1, const Common::Point
}
bool reachedEnd;
if (movement == kMoveLeft || movement == kMoveRight) {
+ if (p2Diff.x == 0) {
+ error("Wrong value for horizontal movement");
+ }
reachedEnd = movement == kMoveLeft ? hero->x <= p2.x : hero->x >= p2.x;
hero->y += hero->x * p2Diff.y / p2Diff.x - prevHero.x * p2Diff.y / p2Diff.x;
} else {
+ if (p2Diff.y == 0) {
+ error("Wrong value for vertical movement");
+ }
reachedEnd = movement == kMoveUp ? hero->y <= p2.y : hero->y >= p2.y;
hero->x += hero->y * p2Diff.x / p2Diff.y - prevHero.y * p2Diff.x / p2Diff.y;
}