From 914c6a3421b15c4d31be04fcb6b6b62abc534b01 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 15 Dec 2025 16:42:50 +0000 Subject: [PATCH] Fix #14917: Crash when opening house picker with no houses available. (#14920) --- src/picker_gui.cpp | 6 ++++-- src/town_gui.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/picker_gui.cpp b/src/picker_gui.cpp index 560fef7983..d821e95c09 100644 --- a/src/picker_gui.cpp +++ b/src/picker_gui.cpp @@ -357,9 +357,11 @@ void PickerWindow::DrawWidget(const Rect &r, WidgetID widget) const break; } - case WID_PW_TYPE_NAME: - DrawString(r, this->callbacks.GetTypeName(this->callbacks.GetSelectedClass(), this->callbacks.GetSelectedType()), TC_GOLD, SA_CENTER); + case WID_PW_TYPE_NAME: { + StringID str = this->callbacks.GetTypeName(this->callbacks.GetSelectedClass(), this->callbacks.GetSelectedType()); + if (str != INVALID_STRING_ID) DrawString(r, str, TC_GOLD, SA_CENTER); break; + } } } diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 8db7915e81..dfd6fc80cd 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -1883,7 +1883,7 @@ struct BuildHouseWindow : public PickerWindow { PickerInvalidations pi(data); if (pi.Test(PickerInvalidation::Position)) { UpdateSelectSize(spec); - this->house_info = GetHouseInformation(spec); + this->house_info = spec->enabled ? GetHouseInformation(spec) : ""; } /* If house spec already has the protected flag, handle it automatically and disable the buttons. */