From 2aada126a254628a3eda6d14788bb6131fe41985 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 12 Sep 2016 20:58:21 +0200 Subject: DM: Fix potential divide by zero --- engines/dm/menus.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/dm') 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; } -- cgit v1.2.3