Fix crash opening landscape window when there are no available objects

See: #713
This commit is contained in:
Jonathan G Rennison 2024-07-06 18:45:41 +01:00
parent 15f4e62936
commit 95245d5a57

View File

@ -120,8 +120,8 @@ uint NewGRFClass<Tspec, Tid, Tmax>::GetUIClassCount()
template <typename Tspec, typename Tid, Tid Tmax>
bool NewGRFClass<Tspec, Tid, Tmax>::HasUIClass()
{
for (uint i = 0; i < Tmax && classes[i].global_id != 0; i++) {
if (classes[i].GetUISpecCount() > 0) return true;
for (const auto &cls : NewGRFClass::classes) {
if (cls.GetUISpecCount() > 0) return true;
}
return false;
}