Fix #35480: object without material crash blender when starting game engine

Was a missing NULL-pointer check. No idea why it took so long to figure
issue out -- apparently there was no crash in linux for me and msvc
didn't show any backtrace :S

Also corrected weirdo way of bit flag check which was:
  !ma->mode & MA_FACETEXTURE
better do !(ma->mode & MA_FACETEXTURE) since ! is a logic NOT.
This commit is contained in:
Sergey Sharybin 2013-05-27 15:13:14 +00:00
parent 5a96c739c1
commit 880c132b11

@ -905,7 +905,7 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
ConvertMaterial(bl_mat, ma, tface, tfaceName, mface, mcol,
converter->GetGLSLMaterials());
if ((!ma->mode & MA_FACETEXTURE))
if (ma && (ma->mode & MA_FACETEXTURE) == 0)
converter->CacheBlenderMaterial(ma, bl_mat);
}
@ -921,7 +921,7 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
kx_blmat->Initialize(scene, bl_mat, (ma?&ma->game:NULL), lightlayer);
polymat = static_cast<RAS_IPolyMaterial*>(kx_blmat);
if ((!ma->mode & MA_FACETEXTURE))
if (ma && (ma->mode & MA_FACETEXTURE) == 0)
converter->CachePolyMaterial(ma, polymat);
}
}