aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}