Fix #11819, aa5ba5b: Out-of-bounds access in linkgraph GUI. (#11821)

This commit is contained in:
frosch 2024-01-17 22:26:33 +01:00 committed by GitHub
parent 2d77cf9c80
commit f457be5a27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -680,7 +680,7 @@ void LinkGraphLegendWindow::UpdateOverlayCompanies()
void LinkGraphLegendWindow::UpdateOverlayCargoes()
{
CargoTypes mask = 0;
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
for (uint c = 0; c < num_cargo; c++) {
if (!this->IsWidgetLowered(WID_LGL_CARGO_FIRST + c)) continue;
SetBit(mask, _sorted_cargo_specs[c]->Index());
}