From 95245d5a572034b617799bf1f124ae777061589f Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 6 Jul 2024 18:45:41 +0100 Subject: [PATCH] Fix crash opening landscape window when there are no available objects See: #713 --- src/newgrf_class_func.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/newgrf_class_func.h b/src/newgrf_class_func.h index e4294b07d2..6142459dbc 100644 --- a/src/newgrf_class_func.h +++ b/src/newgrf_class_func.h @@ -120,8 +120,8 @@ uint NewGRFClass::GetUIClassCount() template bool NewGRFClass::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; }