forked from github/server
avoid crashing because of bug 2182
This commit is contained in:
parent
b75b25c046
commit
3d7b22fa21
1 changed files with 8 additions and 4 deletions
|
@ -944,15 +944,19 @@ static region *readregion(struct gamedata *data, int x, int y)
|
|||
READ_INT(data->store, &n);
|
||||
rsetherbs(r, (short)n);
|
||||
READ_INT(data->store, &n);
|
||||
rsetpeasants(r, n);
|
||||
if (n < 0) {
|
||||
/* bug 2182 */
|
||||
log_error("data has negative peasants: %d in %s", n, regionname(r, 0));
|
||||
rsetpeasants(r, 0);
|
||||
}
|
||||
else {
|
||||
rsetpeasants(r, n);
|
||||
}
|
||||
READ_INT(data->store, &n);
|
||||
rsetmoney(r, n);
|
||||
}
|
||||
|
||||
assert(r->terrain != NULL);
|
||||
assert(rhorses(r) >= 0);
|
||||
assert(rpeasants(r) >= 0);
|
||||
assert(rmoney(r) >= 0);
|
||||
|
||||
if (r->land) {
|
||||
int n;
|
||||
|
|
Loading…
Reference in a new issue