diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index c720e2c6aa..33f086c6fd 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -280,6 +280,11 @@ namespace MWScript int newLevel = static_cast (value-modifier); + if (newLevel<0) + newLevel = 0; + else if (newLevel>100) + newLevel = 100; + progress = (progress / stats.getSkillGain (mIndex, class_, -1, level)) * stats.getSkillGain (mIndex, class_, -1, newLevel);