forked from github/server
report missing itemtype before crashing
This commit is contained in:
parent
7038b021de
commit
d388a94f36
|
@ -400,24 +400,27 @@ void create_backup(char *file)
|
||||||
|
|
||||||
void read_items(struct storage *store, item ** ilist)
|
void read_items(struct storage *store, item ** ilist)
|
||||||
{
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char ibuf[32];
|
char ibuf[32];
|
||||||
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);
|
}
|
||||||
READ_INT(store, &i);
|
itype = it_find(ibuf);
|
||||||
if (i <= 0) {
|
READ_INT(store, &i);
|
||||||
log_error("data contains an entry with %d %s\n", i, itype->rtype->_name[1]);
|
if (i <= 0) {
|
||||||
} else {
|
log_error("data contains an entry with %d %s\n", i, itype->rtype->_name[1]);
|
||||||
assert(itype != NULL);
|
} else {
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_alliances(struct storage *store)
|
static void read_alliances(struct storage *store)
|
||||||
|
|
Loading…
Reference in New Issue