summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 56d3ccbaae..bb5e894e17 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -3573,6 +3573,10 @@ void monsters::apply_enchantments(int spd)
{
mon_enchant_list::iterator cur = i++;
apply_enchantment(*cur, spd);
+
+ // If the monster died, the iterator will be invalid!
+ if (!alive())
+ break;
}
}