fix possible crasg in recent texface commit - material pointer could be used un-iniri...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 20 Sep 2011 04:45:01 +0000 (04:45 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 20 Sep 2011 04:45:01 +0000 (04:45 +0000)
source/blender/editors/space_view3d/drawmesh.c

index 42ee6c0f00a9fba70deb260b445d6ed8aec13c35..37abf01b0da10bdbabe4d32546d4b83db39d06fc 100644 (file)
@@ -518,15 +518,14 @@ static int draw_em_tf_mapped__set_draw(void *userData, int index)
 static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
 {
        Mesh *me = (Mesh*)userData;
-       Material *ma;
 
        if (me->mface) {
-               int matnr = me->mface[index].mat_nr;
-               ma = me->mat[matnr];
-       }
+               short matnr= me->mface[index].mat_nr;
+               Material *ma= me->mat[matnr];
 
-       if ( ma && (ma->game.flag & GEMAT_INVISIBLE)) {
-               return 0;
+               if (ma && (ma->game.flag & GEMAT_INVISIBLE)) {
+                       return 0;
+               }
        }
 
        *drawSmooth_r = 1;