Fix: comparison of narrow type to wide type in loop (potential for infinite loops)

This commit is contained in:
Rubidium
2021-05-10 23:43:52 +02:00
committed by rubidium42
parent 031e91de6e
commit bb9121dbd4
10 changed files with 21 additions and 20 deletions

View File

@@ -1219,7 +1219,7 @@ public:
StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data;
for (auto station_class : this->station_classes) {
StationClass *stclass = StationClass::Get(station_class);
for (uint16 j = 0; j < stclass->GetSpecCount(); j++) {
for (uint j = 0; j < stclass->GetSpecCount(); j++) {
const StationSpec *statspec = stclass->GetSpec(j);
SetDParam(0, (statspec != nullptr && statspec->name != 0) ? statspec->name : STR_STATION_CLASS_DFLT);
d = maxdim(d, GetStringBoundingBox(str));