aboutsummaryrefslogtreecommitdiff
path: root/engines/dm
diff options
context:
space:
mode:
authorStrangerke2016-09-12 20:58:21 +0200
committerStrangerke2016-09-12 20:58:21 +0200
commit2aada126a254628a3eda6d14788bb6131fe41985 (patch)
treed8aa2c5751c13442b6f366f883ab31479c148f56 /engines/dm
parent3be1c24af88db19eee5d76ae88d51aaefdc0ec13 (diff)
downloadscummvm-rg350-2aada126a254628a3eda6d14788bb6131fe41985.tar.gz
scummvm-rg350-2aada126a254628a3eda6d14788bb6131fe41985.tar.bz2
scummvm-rg350-2aada126a254628a3eda6d14788bb6131fe41985.zip
DM: Fix potential divide by zero
Diffstat (limited to 'engines/dm')
-rw-r--r--engines/dm/menus.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp
index 31f6224236..262d74a401 100644
--- a/engines/dm/menus.cpp
+++ b/engines/dm/menus.cpp
@@ -1317,6 +1317,9 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) {
if (setDirectionFl) {
setChampionDirectionToPartyDirection(curChampion);
if (curChampion->_currMana < requiredManaAmount) {
+ // Fix potential divide by zero
+ if (!requiredManaAmount)
+ requiredManaAmount = 1;
kineticEnergy = MAX(2, curChampion->_currMana * kineticEnergy / requiredManaAmount);
requiredManaAmount = curChampion->_currMana;
}