BGE: Fix for [#35320] "Crash When Adding Property without Setting Material" reported by Leon Cheung.

Adding an extra NULL check to draw_mesh_text() to avoid accessing a NULL material array.
This commit is contained in:
Mitchell Stokes 2013-05-13 05:37:45 +00:00
parent 82612ae950
commit 8576a275dc

@ -630,9 +630,10 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
for (a = 0, mp = mface; a < totpoly; a++, mtpoly++, mp++) {
short matnr = mp->mat_nr;
int mf_smooth = mp->flag & ME_SMOOTH;
Material *mat = me->mat[matnr];
Material *mat = (me->mat) ? me->mat[matnr] : NULL;
int mode = mat ? mat->game.flag : GEMAT_INVISIBLE;
if (!(mode & GEMAT_INVISIBLE) && (mode & GEMAT_TEXT) && mp->totloop >= 3) {
/* get the polygon as a tri/quad */
int mp_vi[4];