From 2c473d84ee0c061f9ef046660562c5d38012ca60 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sun, 14 Apr 2019 12:47:11 +0300 Subject: [PATCH] Fix zero division in enchantment magnitude calculation --- apps/openmw/mwworld/inventorystore.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index 08a30c78f..2dedd863f 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -644,7 +644,8 @@ void MWWorld::InventoryStore::updateMagicEffects(const Ptr& actor) { int delta = effect.mMagnMax - effect.mMagnMin; // Roll some dice, one for each effect - params[i].mRandom = Misc::Rng::rollDice(delta + 1) / static_cast(delta); + if (delta) + params[i].mRandom = Misc::Rng::rollDice(delta + 1) / static_cast(delta); // Try resisting each effect params[i].mMultiplier = MWMechanics::getEffectMultiplier(effect.mEffectID, actor, actor); ++i;