summaryrefslogtreecommitdiff
path: root/src/gui/windows/skilldialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-21 02:51:37 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-21 02:51:37 +0300
commite7ebc6c703cd31577bd78f7b133ba18c5dfab1a9 (patch)
treecac38b119279d8201d9026a359e3ea7f717628bb /src/gui/windows/skilldialog.cpp
parent985a6b7f5374f3d7310f3d6cec95874f2f3d81b8 (diff)
downloadmanaplus-e7ebc6c703cd31577bd78f7b133ba18c5dfab1a9.tar.gz
manaplus-e7ebc6c703cd31577bd78f7b133ba18c5dfab1a9.tar.bz2
manaplus-e7ebc6c703cd31577bd78f7b133ba18c5dfab1a9.tar.xz
manaplus-e7ebc6c703cd31577bd78f7b133ba18c5dfab1a9.zip
Fix possible crash in skill cooldowns.
Diffstat (limited to 'src/gui/windows/skilldialog.cpp')
-rw-r--r--src/gui/windows/skilldialog.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index c5eb45c02..a11e0b5aa 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -849,7 +849,7 @@ void SkillDialog::addSkillDuration(SkillInfo *const skill)
void SkillDialog::slowLogic()
{
- FOR_EACH (std::vector<SkillInfo*>::iterator, it, mDurations)
+ FOR_EACH_SAFE (std::vector<SkillInfo*>::iterator, it, mDurations)
{
SkillInfo *const skill = *it;
if (skill)
@@ -861,6 +861,8 @@ void SkillDialog::slowLogic()
skill->cooldown = 0;
skill->duration = 0;
skill->durationTime = 0;
+ if (it == mDurations.end())
+ return;
if (it != mDurations.begin())
-- it;
}