Fix: Allow resolving house parent scope (town) of unbuilt houses. (#12695)

Return unavailable variable result, instead of nullptr dereference.
This commit is contained in:
Peter Nelson 2024-05-18 12:33:50 +01:00 committed by GitHub
parent 3f5a354f37
commit ba47d1ca2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -17,6 +17,11 @@
/* virtual */ uint32_t TownScopeResolver::GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool *available) const
{
if (this->t == nullptr) {
*available = false;
return UINT_MAX;
}
CargoID cid;
switch (variable) {
/* Larger towns */