tweak military-assign: fix likely missing bounds check

develop
lethosor 2021-09-07 01:18:13 -04:00
parent 91e7e12464
commit badf19b424
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 1 additions and 1 deletions

@ -77,7 +77,7 @@ struct military_assign_hook : df::viewscreen_layer_militaryst {
int i1 = plist->getFirstVisible(), i2 = plist->getLastVisible(); int i1 = plist->getFirstVisible(), i2 = plist->getLastVisible();
int si = plist->getListCursor(); int si = plist->getListCursor();
for (int y = y1, i = i1; i <= i2; i++, y++) for (int y = y1, i = i1; i <= i2 && y <= y2; i++, y++)
{ {
auto unit = vector_get(positions.candidates, i); auto unit = vector_get(positions.candidates, i);
if (!unit || unit->military.squad_id < 0) if (!unit || unit->military.squad_id < 0)