Fix #14917: Crash when opening house picker with no houses available. (#14920)

This commit is contained in:
Peter Nelson
2025-12-15 16:42:50 +00:00
committed by dP
parent 160807c788
commit 914c6a3421
2 changed files with 5 additions and 3 deletions

View File

@@ -357,10 +357,12 @@ 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;
}
}
}
void PickerWindow::OnResize()

View File

@@ -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. */