diff --git a/src/makemon.c b/src/makemon.c index b4da8f5ad..d03801d65 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -2216,7 +2216,7 @@ register struct monst *mtmp; ap_type = M_AP_OBJECT; appear = -s_sym; } else { - if (s_sym == RANDOM_CLASS) + if (s_sym == RANDOM_CLASS || s_sym >= MAXOCLASSES) s_sym = syms[rn2((int) sizeof(syms) - 2) + 2]; goto assign_sym; } diff --git a/src/shknam.c b/src/shknam.c index 8e64c9b9b..0d61a95d1 100644 --- a/src/shknam.c +++ b/src/shknam.c @@ -802,7 +802,8 @@ struct obj *obj; return FALSE; } -/* positive value: class; negative value: specific object type */ +/* positive value: class; negative value: specific object type. + can also return non-existing object class (eg. VEGETARIAN_CLASS) */ int get_shop_item(type) int type;