Skip to content

Commit 4a435ac

Browse files
AlpyneDreamsmisyltoad
authored andcommitted
Fix debug renderer causing access violation at exit
Destructor was running after material system had shut down
1 parent 12834b8 commit 4a435ac

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

vphysics_jolt/vjolt_debugrender.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ JoltPhysicsDebugRenderer::~JoltPhysicsDebugRenderer()
4747

4848
JoltPhysicsDebugRenderer::BatchImpl::~BatchImpl()
4949
{
50-
CMatRenderContextPtr pRenderContext(g_pMaterialSystem);
50+
if ( !g_pMaterialSystem )
51+
return;
52+
53+
CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
5154
for (int i = 0; i < m_Meshes.Count(); i++)
52-
pRenderContext->DestroyStaticMesh(m_Meshes[i]);
55+
pRenderContext->DestroyStaticMesh( m_Meshes[i] );
5356
}
5457

5558
void JoltPhysicsDebugRenderer::DrawLine( JPH::Vec3Arg inFrom, JPH::Vec3Arg inTo, JPH::ColorArg inColor )

0 commit comments

Comments
 (0)