forked from github/server
coverity scan CID 22503: negative array index write
This commit is contained in:
parent
c7aa8c89b1
commit
6ebfd33478
1 changed files with 5 additions and 1 deletions
|
@ -414,6 +414,7 @@ summary *make_summary(void)
|
|||
for (u = r->units; u; u = u->next)
|
||||
freset(u->faction, FFL_SELECT);
|
||||
for (u = r->units; u; u = u->next) {
|
||||
int orace;
|
||||
f = u->faction;
|
||||
if (!is_monsters(u->faction)) {
|
||||
skill *sv;
|
||||
|
@ -452,7 +453,10 @@ summary *make_summary(void)
|
|||
|
||||
f->num_total += u->number;
|
||||
f->money += get_money(u);
|
||||
s->poprace[old_race(u_race(u))] += u->number;
|
||||
orace = (int)old_race(u_race(u));
|
||||
if (orace >= 0) {
|
||||
s->poprace[orace] += u->number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue