From aa4fda7e26939ab4ab54e1d6748eb40ad9200e00 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 25 Nov 2005 23:39:50 +0000 Subject: [PATCH] kingdoms: null-pointer crash if potion type does not exist --- src/common/kernel/item.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index 4653a70ad..aed68d039 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -1301,10 +1301,12 @@ init_oldpotions(void) for (p=0;p!=MAXPOTIONS;++p) { item_type * itype = it_find(potionnames[p]); - if (potiontext[p]) { - locale_setstring(default_locale, mkname("potion", potionnames[p]), potiontext[p]); + if (itype!=NULL) { + if (potiontext[p]) { + locale_setstring(default_locale, mkname("potion", potionnames[p]), potiontext[p]); + } + oldpotiontype[p] = itype->rtype->ptype; } - oldpotiontype[p] = itype->rtype->ptype; } }