Merged changes in the trunk up to revision 28536.
[blender.git] / source / blender / blenkernel / intern / material.c
index cf02f49a6f3e6ec8432e369c21f984113369b9d0..b4b29089af9987db28822a3b2fa165b1f2b912e0 100644 (file)
@@ -452,7 +452,7 @@ Material *give_current_material(Object *ob, int act)
        if(act>ob->totcol) act= ob->totcol;
        else if(act<=0) act= 1;
 
-       if(ob->matbits[act-1]) {        /* in object */
+       if(ob->matbits && ob->matbits[act-1]) { /* in object */
                ma= ob->mat[act-1];
        }
        else {                                                          /* in data */