diff --git a/src/game/boe.monster.cpp b/src/game/boe.monster.cpp index 5026fa01..cfc579ed 100644 --- a/src/game/boe.monster.cpp +++ b/src/game/boe.monster.cpp @@ -1187,7 +1187,8 @@ void activate_monsters(short code,short /*attitude*/) { mon_num_t get_summon_monster(short summon_class) { for(short i = 0; i < 200; i++) { - short j = get_ran(1,0,255); + // this assumes that there is at least one monster + short j = get_ran(1,0,univ.scenario.scen_monsters.size()-1); if(univ.scenario.scen_monsters[j].summon_type == summon_class) { return j; }