Prevent segfaults, makemon can return null
This commit is contained in:
@@ -122,13 +122,15 @@ register int x, y, n;
|
||||
*/
|
||||
if (enexto(&mm, mm.x, mm.y, mtmp->data)) {
|
||||
mon = makemon(mtmp->data, mm.x, mm.y, NO_MM_FLAGS);
|
||||
mon->mpeaceful = FALSE;
|
||||
mon->mavenge = 0;
|
||||
set_malign(mon);
|
||||
/* Undo the second peace_minded() check in makemon(); if the
|
||||
* monster turned out to be peaceful the first time we
|
||||
* didn't create it at all; we don't want a second check.
|
||||
*/
|
||||
if (mon) {
|
||||
mon->mpeaceful = FALSE;
|
||||
mon->mavenge = 0;
|
||||
set_malign(mon);
|
||||
/* Undo the second peace_minded() check in makemon(); if the
|
||||
* monster turned out to be peaceful the first time we
|
||||
* didn't create it at all; we don't want a second check.
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user