Fixed crash when using --check-debug: when determining the checkline

requirements, no karts are created yet, so printing the kart id
causes a crash.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11079 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2012-04-03 22:27:11 +00:00
parent 682a6453fc
commit fcb8aaf9c6

View File

@@ -146,9 +146,16 @@ bool CheckLine::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, int indx)
new_pos.getY()-m_min_height>-m_under_min_height;
if(UserConfigParams::m_check_debug && !result)
{
printf("CHECK: Kart %s crosses line, but wrong height (%f vs %f).\n",
World::getWorld()->getKart(indx)->getIdent().c_str(),
new_pos.getY(), m_min_height);
if(World::getWorld()->getNumKarts()>0)
printf("CHECK: Kart %s crosses line, but wrong height "
"(%f vs %f).\n",
World::getWorld()->getKart(indx)->getIdent().c_str(),
new_pos.getY(), m_min_height);
else
printf("CHECK: Kart %d crosses line, but wrong height "
"(%f vs %f).\n",
indx, new_pos.getY(), m_min_height);
}
}
else