forked from github/server
report missing itemtype before crashing
This commit is contained in:
parent
7038b021de
commit
d388a94f36
|
@ -405,17 +405,20 @@ void read_items(struct storage *store, item ** ilist)
|
||||||
const item_type *itype;
|
const item_type *itype;
|
||||||
int i;
|
int i;
|
||||||
READ_STR(store, ibuf, sizeof(ibuf));
|
READ_STR(store, ibuf, sizeof(ibuf));
|
||||||
if (!strcmp("end", ibuf))
|
if (!strcmp("end", ibuf)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
itype = it_find(ibuf);
|
itype = it_find(ibuf);
|
||||||
READ_INT(store, &i);
|
READ_INT(store, &i);
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
log_error("data contains an entry with %d %s\n", i, itype->rtype->_name[1]);
|
log_error("data contains an entry with %d %s\n", i, itype->rtype->_name[1]);
|
||||||
} else {
|
} else {
|
||||||
assert(itype != NULL);
|
|
||||||
if (itype != NULL) {
|
if (itype != NULL) {
|
||||||
i_change(ilist, itype, i);
|
i_change(ilist, itype, i);
|
||||||
|
} else {
|
||||||
|
log_error("data contains unknown item type %s.\n", ibuf);
|
||||||
}
|
}
|
||||||
|
assert(itype != NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue