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,11 +1301,13 @@ init_oldpotions(void)
for (p=0;p!=MAXPOTIONS;++p) { for (p=0;p!=MAXPOTIONS;++p) {
item_type * itype = it_find(potionnames[p]); item_type * itype = it_find(potionnames[p]);
if (itype!=NULL) {
if (potiontext[p]) { if (potiontext[p]) {
locale_setstring(default_locale, mkname("potion", potionnames[p]), potiontext[p]); locale_setstring(default_locale, mkname("potion", potionnames[p]), potiontext[p]);
} }
oldpotiontype[p] = itype->rtype->ptype; oldpotiontype[p] = itype->rtype->ptype;
} }
}
} }
resource_type * r_silver; resource_type * r_silver;