bug 2282: Datenfile 2012 kaputt.

make the reader for at_keys accept that sometimes, there are 0 keys.
This commit is contained in:
Enno Rehling 2017-02-12 19:57:02 +01:00
parent 3d8d091207
commit f132dfe4d4
1 changed files with 4 additions and 1 deletions

View File

@ -38,7 +38,10 @@ static void a_writekeys(const attrib *a, const void *o, storage *store) {
static int a_readkeys(attrib * a, void *owner, gamedata *data) { static int a_readkeys(attrib * a, void *owner, gamedata *data) {
int i, *p = 0; int i, *p = 0;
READ_INT(data->store, &i); READ_INT(data->store, &i);
assert(i < 4096 && i>0); assert(i < 4096 && i>=0);
if (i == 0) {
return AT_READ_FAIL;
}
a->data.v = p = malloc(sizeof(int)*(i + 1)); a->data.v = p = malloc(sizeof(int)*(i + 1));
*p++ = i; *p++ = i;
while (i--) { while (i--) {