Hopefully fixed crash in case that a bubblegum is dropped 'over nothing'.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6313 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-10-19 20:35:18 +00:00
parent 716f7e4942
commit 8708d5b654

View File

@ -232,15 +232,18 @@ void Powerup::use()
case PowerupManager::POWERUP_BUBBLEGUM:
{
m_sound_use->position(m_owner->getXYZ());
m_sound_use->play();
btVector3 pos = m_owner->getXYZ();
float up_coord = Track::NOHIT;
Vec3 normal;
const Material* unused2;
btVector3 pos = m_owner->getXYZ();
world->getTrack()->getTerrainInfo(pos, &up_coord, &normal, &unused2);
// This can happen if the kart is 'over nothing' when dropping
// the bubble gum
if(up_coord==Track::NOHIT)
return;
normal.normalize();
assert(up_coord != Track::NOHIT);
m_sound_use->position(m_owner->getXYZ());
m_sound_use->play();
pos.setY(up_coord-0.05f);