Skip to content

Commit

Permalink
Fix deref-before-null-check coverity defect
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram authored May 14, 2020
1 parent f46d4d4 commit 6b32ed7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/RageUtil/Graphics/RageDisplay_OGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2775,15 +2775,16 @@ RageDisplay_Legacy::CreateRenderTarget(const RenderTargetParam& param,
pTarget = new RenderTarget_FramebufferObject;
else
pTarget = g_pWind->CreateRenderTarget();

pTarget->Create(param, iTextureWidthOut, iTextureHeightOut);

intptr_t iTexture = pTarget->GetTexture();

ASSERT(g_mapRenderTargets.find(iTexture) == g_mapRenderTargets.end());
if (pTarget)
if (pTarget) {
pTarget->Create(param, iTextureWidthOut, iTextureHeightOut);
intptr_t iTexture = pTarget->GetTexture();
ASSERT(g_mapRenderTargets.find(iTexture) == g_mapRenderTargets.end());
g_mapRenderTargets[iTexture] = pTarget;

}

return iTexture;
}

Expand Down

0 comments on commit 6b32ed7

Please sign in to comment.