Skip to content

Commit

Permalink
Fix m_playerMarkerTexture access violation when it was not initialize…
Browse files Browse the repository at this point in the history
…d before attempting to free
  • Loading branch information
Fernando-A-Rocha committed Dec 18, 2024
1 parent b1f2a70 commit bb6c33e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Client/mods/deathmatch/logic/CPlayerMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ CPlayerMap::CPlayerMap(CClientManager* pManager)
m_iHorizontalMovement = 0;
m_iVerticalMovement = 0;

// Init texture vars
m_mapImageTexture = nullptr;
m_playerMarkerTexture = nullptr;

// Create all map textures
CreateAllTextures();

Expand Down Expand Up @@ -105,10 +109,8 @@ CPlayerMap::~CPlayerMap()
// Delete our images
SAFE_RELEASE(m_mapImageTexture);
SAFE_RELEASE(m_playerMarkerTexture);

for (uint i = 0; i < m_markerTextureList.size(); i++)
SAFE_RELEASE(m_markerTextureList[i]);

m_markerTextureList.clear();

// Don't need to delete the help texts as those are destroyed by the display manager
Expand Down Expand Up @@ -154,7 +156,6 @@ void CPlayerMap::CreateAllTextures()
try
{
// Create the map texture
m_mapImageTexture = nullptr;
m_playerMapImageIndex = g_pCore->GetCVars()->GetValue<std::size_t>("mapimage");
CreateOrUpdateMapTexture();

Expand Down

0 comments on commit bb6c33e

Please sign in to comment.