Skip to content

Commit

Permalink
Fix possible crash
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX committed Sep 20, 2024
1 parent 738c13d commit a6d3c2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Client/game_sa/C2DEffectSAInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class C2DEffectSA
static int effect2dPluginOffset;
};

static void PrepareTexturesForLightEffect(RwTexture* coronaTex, RwTexture* shadowTex, const char* coronaName, const char* shadowName, bool removeIfExist)
static void PrepareTexturesForLightEffect(RwTexture*& coronaTex, RwTexture*& shadowTex, const char* coronaName, const char* shadowName, bool removeIfExist)
{
// Call CTxdStore::PushCurrentTxd
((void(__cdecl*)())FUNC_PushCurrentTxd)();
Expand Down
8 changes: 4 additions & 4 deletions Client/game_sa/CModelInfoSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2089,7 +2089,10 @@ void CModelInfoSA::StoreDefault2DFXEffect(C2DEffectSAInterface* effect)
// Create a copy of textures for the lights
// We must to do this, because C2DEffect::Shutdown removes them
if (copy->type == e2dEffectType::LIGHT)
PrepareTexturesForLightEffect(copy->effect.light.coronaTex, copy->effect.light.shadowTex, effect->effect.light.coronaTex->name, effect->effect.light.shadowTex->name, false);
{
if (effect->effect.light.coronaTex && effect->effect.light.shadowTex)
PrepareTexturesForLightEffect(copy->effect.light.coronaTex, copy->effect.light.shadowTex, effect->effect.light.coronaTex->name, effect->effect.light.shadowTex->name, false);
}
else if (copy->type == e2dEffectType::ROADSIGN)
{
// Create a copy of text and atomic for the roadsign
Expand Down Expand Up @@ -2181,9 +2184,6 @@ C2DEffectSAInterface* CModelInfoSA::Add2DFXEffect(const CVector& position, const
// Save our effect
d2fxEffects.push_back(effectInterface);

// Keep original effects
StoreDefault2DFXEffect(effectInterface);

return effectInterface;
}

Expand Down

0 comments on commit a6d3c2a

Please sign in to comment.