VideoTexture: fix NULL pointer crash when material name is not found.
[blender.git] / source / gameengine / VideoTexture / Texture.cpp
index 243c5f31db00a98fc9ef53618db25793fc828f87..ea3f60b2775b7b806ae84b1622bc893c30421ffc 100644 (file)
@@ -96,7 +96,7 @@ RAS_IPolyMaterial * getMaterial (PyObject *obj, short matID)
                        // get material from mesh
                        RAS_MeshObject * mesh = gameObj->GetMesh(0);
                        RAS_MeshMaterial *meshMat = mesh->GetMeshMaterial(matID);
-                       if (meshMat->m_bucket != NULL)
+                       if (meshMat != NULL && meshMat->m_bucket != NULL)
                                // return pointer to polygon or blender material
                                return meshMat->m_bucket->GetPolyMaterial();
                }