Fix crash

This commit is contained in:
Benau 2018-09-09 01:03:40 +08:00
parent 33a983a701
commit 7478ed6ad4

View File

@ -32,8 +32,6 @@
#include <algorithm> #include <algorithm>
class AbstractKart;
namespace SP namespace SP
{ {
SPShaderManager* SPShaderManager::m_spsm = NULL; SPShaderManager* SPShaderManager::m_spsm = NULL;
@ -66,8 +64,13 @@ SPShaderManager::SPShaderManager()
}, },
{ "dirtFactorUniformAssigner", [](SPUniformAssigner* ua) { "dirtFactorUniformAssigner", [](SPUniformAssigner* ua)
{ {
Camera *camera = Camera::getCamera(0); AbstractKart* k = NULL;
if (camera && camera->getKart()->isOnGround()) if (Camera::getNumCameras() > 1)
{
Camera* camera = Camera::getCamera(0);
k = camera->getKart();
}
if (k && k->isOnGround())
{ {
ua->setValue(2.0f); ua->setValue(2.0f);
} }