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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2003-12-31 18:27:31 +0300
committerTon Roosendaal <ton@blender.org>2003-12-31 18:27:31 +0300
commit3eee89e393b8f4e387de9495d928a8c5741a8eaa (patch)
tree77089b4fcd904e9834a4d76b8b821cf88cc1e22c /source
parent10c0f4ae9fe3249cbbe9fe83887fcb040a8a4b3b (diff)
- added extra check for valid Material pointer array in Mesh. Someone
reported crash with a popular Python script that apparantly doesnt initialize a Mesh good (setting totcol, but not creating pointer array) When no Material array is present, 'totcol' is set at zero now.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenloader/intern/readfile.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 9631bcc958a..e44aae82ae2 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1912,9 +1912,13 @@ static void lib_link_mesh(FileData *fd, Main *main)
if(me->id.flag & LIB_NEEDLINK) {
int i;
- for(i=0; i<me->totcol; i++)
- me->mat[i]= newlibadr_us(fd, me->id.lib, me->mat[i]);
-
+ /* this check added for python created meshes */
+ if(me->mat) {
+ for(i=0; i<me->totcol; i++)
+ me->mat[i]= newlibadr_us(fd, me->id.lib, me->mat[i]);
+ }
+ else me->totcol= 0;
+
me->ipo= newlibadr_us(fd, me->id.lib, me->ipo);
me->key= newlibadr_us(fd, me->id.lib, me->key);
me->texcomesh= newlibadr_us(fd, me->id.lib, me->texcomesh);