bug of mine fixed

didnt chech that a material existed before accessing it- crashed with null materials and mesh.getFromObject()
This commit is contained in:
2006-09-15 14:52:59 +00:00
parent cca79d086a
commit 6dbf2ccf55

View File

@@ -5763,11 +5763,16 @@ static PyObject *Mesh_getFromObject( BPy_Mesh * self, PyObject * args )
/* are we an object material or data based? */
if (ob->colbits & 1<<i) {
self->mesh->mat[i] = ob->mat[i];
ob->mat[i]->id.us++;
origmesh->mat[i]->id.us--;
if (ob->mat[i])
ob->mat[i]->id.us++;
if (origmesh->mat[i])
origmesh->mat[i]->id.us--;
} else {
origmesh->mat[i]->id.us++;
self->mesh->mat[i] = origmesh->mat[i];
if (origmesh->mat[i])
origmesh->mat[i]->id.us++;
}
}
}