Prevent a segfault with leashed vanished monster
It's apparently somehow possible to have a leash "attached" to a monster not present on the current level. Complain instead of segfaulting. (This is a post-3.6.0 bug)
This commit is contained in:
+9
-2
@@ -912,8 +912,15 @@ unsigned doname_flags;
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (obj->otyp == LEASH && obj->leashmon != 0) {
|
if (obj->otyp == LEASH && obj->leashmon != 0) {
|
||||||
Sprintf(eos(bp), " (attached to %s)",
|
struct monst *mlsh = find_mid(obj->leashmon, FM_FMON);
|
||||||
a_monnam(find_mid(obj->leashmon, FM_FMON)));
|
|
||||||
|
if (!mlsh) {
|
||||||
|
impossible("leashed monster not on this level");
|
||||||
|
obj->leashmon = 0;
|
||||||
|
} else {
|
||||||
|
Sprintf(eos(bp), " (attached to %s)",
|
||||||
|
a_monnam(mlsh));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (obj->otyp == CANDELABRUM_OF_INVOCATION) {
|
if (obj->otyp == CANDELABRUM_OF_INVOCATION) {
|
||||||
|
|||||||
Reference in New Issue
Block a user