Skip to content

Commit

Permalink
Fix assert when model info is missing (Fixes #3192, PR #3194)
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
TheNormalnij committed Sep 23, 2023
1 parent 1f7937b commit d431e5e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Client/game_sa/CModelInfoSA.cpp
Expand Up @@ -812,10 +812,18 @@ void CModelInfoSA::ResetTextureDictionaryID()

void CModelInfoSA::StaticResetTextureDictionaries()
{
while (!ms_DefaultTxdIDMap.empty()) {
while (!ms_DefaultTxdIDMap.empty())
{
const auto mi = pGame->GetModelInfo(ms_DefaultTxdIDMap.begin()->first);
assert(mi);
mi->ResetTextureDictionaryID();
if (mi)
{
mi->ResetTextureDictionaryID();
}
else
{
// Model was deallocated. Skip and remove it from our list.
ms_DefaultTxdIDMap.erase(ms_DefaultTxdIDMap.begin());
}
}
}

Expand Down

0 comments on commit d431e5e

Please sign in to comment.