diff --git a/examples/common/debugdraw/debugdraw.cpp b/examples/common/debugdraw/debugdraw.cpp index 8493b87f6..f297d1650 100644 --- a/examples/common/debugdraw/debugdraw.cpp +++ b/examples/common/debugdraw/debugdraw.cpp @@ -467,9 +467,10 @@ struct DebugDraw { bgfx::destroyIndexBuffer(m_ibh); bgfx::destroyVertexBuffer(m_vbh); - bgfx::destroyProgram(m_program[0]); - bgfx::destroyProgram(m_program[1]); - bgfx::destroyProgram(m_program[2]); + for (uint32_t ii = 0; ii < Program::Count; ++ii) + { + bgfx::destroyProgram(m_program[ii]); + } bgfx::destroyUniform(u_params); }