Valenar crash: bad report interval when a faction has no units.

This commit is contained in:
Enno Rehling 2017-06-26 20:39:05 +02:00
parent 1e78414562
commit 7790ebd671
1 changed files with 33 additions and 28 deletions

View File

@ -1367,6 +1367,9 @@ void reorder_units(region * r)
static region *lastregion(faction * f)
{
if (!f->units) {
return NULL;
}
return f->last ? f->last->next : NULL;
}
@ -1418,6 +1421,7 @@ void prepare_report(report_context *ctx, faction *f)
ctx->addresses = NULL;
ctx->userdata = NULL;
/* [first,last) interval of regions with a unit in it: */
if (f->units) {
ctx->first = firstregion(f);
ctx->last = lastregion(f);
@ -1457,6 +1461,7 @@ void prepare_report(report_context *ctx, faction *f)
travelthru_map(r, cb_add_seen, f);
}
}
}
/* [fast,last) interval of seen regions (with lighthouses and travel)
* TODO: what about neighbours? when are they included? do we need
* them outside of the CR? */