Don't crash for wip-tracks / karts (wrong shader name or incomplete terrain)

This commit is contained in:
Benau 2018-01-15 11:07:58 +08:00
parent 813b08bc73
commit 9c2f91c11b
2 changed files with 4 additions and 2 deletions

View File

@ -522,7 +522,8 @@ std::shared_ptr<video::IImage>
{
// Load colorization mask
std::shared_ptr<video::IImage> mask;
if (SP::getSPShader(m_material->getShaderName())->useAlphaChannel())
SPShader* sps = SP::getSPShader(m_material->getShaderName());
if (sps && sps->useAlphaChannel())
{
Log::debug("SPTexture", "Don't use colorization mask or factor"
" with shader using alpha channel for %s", m_path.c_str());

View File

@ -730,7 +730,8 @@ void World::resetAllKarts()
for (KartList::iterator i = m_karts.begin(); i != m_karts.end(); i++)
{
if ((*i)->isGhostKart()) continue;
(*i)->getBody()->setGravity((*i)->getMaterial()->hasGravity() ?
(*i)->getBody()->setGravity(
(*i)->getMaterial() && (*i)->getMaterial()->hasGravity() ?
(*i)->getNormal() * -g : Vec3(0, -g, 0));
}
for(int i=0; i<60; i++) Physics::getInstance()->update(1.f/60.f);