Fix Coverity warning about odd null check in TempObstacleHilightTool

m_sample was being checked for null after being used, which looks like a
null dereference, though actually if m_sample becomes null, the tool will
be deactivated anyway. Regardless, this code looks more sensible.
This commit is contained in:
Ben Hymers 2016-03-13 23:20:05 +00:00
parent 222fa1ee6f
commit e4791becd5

View File

@ -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);
}
}