Codechange: add non-nullptr asserts in cases where it should never be nullptr

Though where similar calls are checked for nullptr as in those instances of
the use of that function it can actually return nullptr. In other words, write
down the assumption that the function never returns nullptr in an assert.
This commit is contained in:
Rubidium
2023-01-06 23:43:50 +01:00
committed by rubidium42
parent bcfe0fb076
commit 90f1768006
13 changed files with 24 additions and 0 deletions

View File

@@ -1464,6 +1464,9 @@ private:
this->avails.push_back(c);
} else {
const GRFConfig *best = FindGRFConfig(c->ident.grfid, HasBit(c->flags, GCF_INVALID) ? FGCM_NEWEST : FGCM_NEWEST_VALID);
/* Never triggers; FindGRFConfig returns either c, or a newer version of c. */
assert(best != nullptr);
/*
* If the best version is 0, then all NewGRF with this GRF ID
* have version 0, so for backward compatibility reasons we