report missing itemtype before crashing

This commit is contained in:
Enno Rehling 2014-05-24 20:35:00 -07:00
parent 7038b021de
commit d388a94f36
1 changed files with 20 additions and 17 deletions

View File

@ -405,17 +405,20 @@ void read_items(struct storage *store, item ** ilist)
const item_type *itype;
int i;
READ_STR(store, ibuf, sizeof(ibuf));
if (!strcmp("end", ibuf))
if (!strcmp("end", ibuf)) {
break;
}
itype = it_find(ibuf);
READ_INT(store, &i);
if (i <= 0) {
log_error("data contains an entry with %d %s\n", i, itype->rtype->_name[1]);
} else {
assert(itype != NULL);
if (itype != NULL) {
i_change(ilist, itype, i);
} else {
log_error("data contains unknown item type %s.\n", ibuf);
}
assert(itype != NULL);
}
}
}