diff --git a/plugins/tweak/tweaks/military-assign.h b/plugins/tweak/tweaks/military-assign.h index 45f97eac3..92b101e08 100644 --- a/plugins/tweak/tweaks/military-assign.h +++ b/plugins/tweak/tweaks/military-assign.h @@ -77,7 +77,7 @@ struct military_assign_hook : df::viewscreen_layer_militaryst { int i1 = plist->getFirstVisible(), i2 = plist->getLastVisible(); 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); if (!unit || unit->military.squad_id < 0)