Skip to content

Commit bb6c33e

Browse files
Fix m_playerMarkerTexture access violation when it was not initialized before attempting to free
1 parent b1f2a70 commit bb6c33e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Client/mods/deathmatch/logic/CPlayerMap.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ CPlayerMap::CPlayerMap(CClientManager* pManager)
5757
m_iHorizontalMovement = 0;
5858
m_iVerticalMovement = 0;
5959

60+
// Init texture vars
61+
m_mapImageTexture = nullptr;
62+
m_playerMarkerTexture = nullptr;
63+
6064
// Create all map textures
6165
CreateAllTextures();
6266

@@ -105,10 +109,8 @@ CPlayerMap::~CPlayerMap()
105109
// Delete our images
106110
SAFE_RELEASE(m_mapImageTexture);
107111
SAFE_RELEASE(m_playerMarkerTexture);
108-
109112
for (uint i = 0; i < m_markerTextureList.size(); i++)
110113
SAFE_RELEASE(m_markerTextureList[i]);
111-
112114
m_markerTextureList.clear();
113115

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

0 commit comments

Comments
 (0)