diff --git a/RecastDemo/Source/Sample_TempObstacles.cpp b/RecastDemo/Source/Sample_TempObstacles.cpp index a109d1b..c523b7c 100644 --- a/RecastDemo/Source/Sample_TempObstacles.cpp +++ b/RecastDemo/Source/Sample_TempObstacles.cpp @@ -726,7 +726,7 @@ public: virtual void handleRender() { - if (m_hitPosSet) + if (m_hitPosSet && m_sample) { const float s = m_sample->getAgentRadius(); glColor4ub(0,0,0,128); @@ -740,14 +740,10 @@ public: glVertex3f(m_hitPos[0],m_hitPos[1]+0.1f,m_hitPos[2]+s); glEnd(); glLineWidth(1.0f); - - if (m_sample) - { - int tx=0, ty=0; - m_sample->getTilePos(m_hitPos, tx, ty); - m_sample->renderCachedTile(tx,ty,m_drawType); - } + int tx=0, ty=0; + m_sample->getTilePos(m_hitPos, tx, ty); + m_sample->renderCachedTile(tx,ty,m_drawType); } }