You can reproduce easily by summoning a chaos breather and a bunch (20+) of monsters. As long as the monster pack stays dense, a crash should occur. You can also just zapping a wand of polymorph at things until it happens.
The issue is actually in project_m(), which includes a notice at the top about polymorph crashes. In the first above case, this is what seems to be happening:
- chaos breather triggers random polymorph on another monster
- place_new_monster_one() (by way of place_new_monster()) can't place the monster in the location it wants to, so it returns false
- m_ptr is null, since cave_monster_at() doesn't return a monster
- mon_clear_timed() (only in the who > 0 branch) crashes because m_ptr is null
In the second case, the first three steps are the same. The crash just occurs when the check for dam > m_ptr->hp is made in the else branch of who > 0.
The issue is actually in project_m(), which includes a notice at the top about polymorph crashes. In the first above case, this is what seems to be happening:
- chaos breather triggers random polymorph on another monster
- place_new_monster_one() (by way of place_new_monster()) can't place the monster in the location it wants to, so it returns false
- m_ptr is null, since cave_monster_at() doesn't return a monster
- mon_clear_timed() (only in the who > 0 branch) crashes because m_ptr is null
In the second case, the first three steps are the same. The crash just occurs when the check for dam > m_ptr->hp is made in the else branch of who > 0.
Comment