==Python API==
[blender.git] / source / blender / python / api2_2x / Mesh.c
index ce131e3851a9eb3b96e8b55cbdfe1d6a776f6b8e..9440e15bbd87e39c12f4e1c9e6cd1168044db0dd 100644 (file)
@@ -6042,8 +6042,12 @@ static int Mesh_setFlag( BPy_Mesh * self, PyObject *value, void *type )
                                MEM_freeN( mesh->tface );
                                mesh->tface = NULL;
                        }
-               } else if( !mesh->tface )
+               } else if( !mesh->tface ) {
+                       if( !mesh->totface )
+                               return EXPP_ReturnIntError( PyExc_RuntimeError,
+                                       "mesh has no faces" );
                        make_tfaces( mesh );
+               }
                return 0;
        case MESH_HASMCOL:
                if( !param ) {