Skip to content

Commit

Permalink
Fix assert when model info is missing multitheftauto#3192
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNormalnij committed Sep 23, 2023
1 parent 1f7937b commit 32733ae
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Client/game_sa/CModelInfoSA.cpp
Original file line number Diff line number Diff line change
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 dealocated. Skip it and remove from list
ms_DefaultTxdIDMap.erase(ms_DefaultTxdIDMap.begin()->first);
}
}
}

Expand Down

0 comments on commit 32733ae

Please sign in to comment.