Fix #10461, 59645c6: Properly check for _local_company validity

This commit is contained in:
glx22 2023-02-10 02:15:50 +01:00 committed by Loïc Guilloux
parent 59251d3c6b
commit d6aa526b69

View File

@ -229,7 +229,7 @@ public:
case WID_TA_ACTION_INFO:
if (this->sel_index != -1) {
Money action_cost = _price[PR_TOWN_ACTION] * _town_action_costs[this->sel_index] >> 8;
bool affordable = action_cost < Company::GetIfValid(_local_company)->money;
bool affordable = Company::IsValidID(_local_company) && action_cost < Company::Get(_local_company)->money;
SetDParam(0, action_cost);
DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.framerect),