Add sanity checks to getStartTransform to avoid going out of array bounds

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9744 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-09-04 23:33:14 +00:00
parent 256f611bbd
commit 026e7e67ce

View File

@ -313,7 +313,14 @@ public:
/** Returns the start coordinates for a kart with a given index.
* \param index Index of kart ranging from 0 to kart_num-1. */
btTransform getStartTransform (unsigned int index) const
{return m_start_transforms[index];}
{
if (index >= m_start_transforms.size())
{
fprintf(stderr, "No start position for kart %i\n", index);
abort();
}
return m_start_transforms[index];
}
// ------------------------------------------------------------------------
/** Sets pointer to the aabb of this track. */
void getAABB(const Vec3 **min, const Vec3 **max) const