kingdoms: null-pointer crash if potion type does not exist

This commit is contained in:
Enno Rehling 2005-11-25 23:39:50 +00:00
parent 49cd3e08ad
commit aa4fda7e26
1 changed files with 5 additions and 3 deletions

View File

@ -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;
}
}