Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2006-09-15 18:52:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2006-09-15 18:52:59 +0400
commit6dbf2ccf55ed3e686dc4dbb7ebd9f4a99c0c9ff0 (patch)
tree9f73910041365ca073b9226e3d938422d652c475
parentcca79d086a8f9aa4a8e8a6c996eebb241051d0cc (diff)
bug of mine fixed
didnt chech that a material existed before accessing it- crashed with null materials and mesh.getFromObject()
-rw-r--r--source/blender/python/api2_2x/Mesh.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c
index 5e89705cf5a..7aed521c504 100644
--- a/source/blender/python/api2_2x/Mesh.c
+++ b/source/blender/python/api2_2x/Mesh.c
@@ -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++;
}
}
}