From 9e4097d1feda1a12a41ba8e1c05b693bd3729abe Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Mon, 9 Nov 2009 11:12:43 -0600 Subject: And add sanity check. --- crawl-ref/source/mon-util.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/mon-util.cc') diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 6980a3f345..458d2005b3 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1556,11 +1556,12 @@ void define_monster(monsters &mons) if (m->sec == MST_NO_SPELLS && mons_class_flag(mons.type, M_SPELLCASTER)) { mon_spellbook_type book[6]; - _get_spellbook_list(book, mons.type); - - do - spells = book[random2(6)]; - while (spells == MST_NO_SPELLS); + if (_get_spellbook_list(book, mons.type)) + { + do + spells = book[random2(6)]; + while (spells == MST_NO_SPELLS); + } } // Some calculations. -- cgit v1.2.3-54-g00ecf