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:
authorTon Roosendaal <ton@blender.org>2006-11-25 21:15:55 +0300
committerTon Roosendaal <ton@blender.org>2006-11-25 21:15:55 +0300
commitf554aa8a354ce438a5d463919b2e7f8e608b1e71 (patch)
tree76d0394b4283f2842208b94bb08e2f83b4b8449d /source/blender/blenkernel/intern/material.c
parent8292e4ac1a3b475f3238bcd537fa6182e5b9ac69 (diff)
Bugfix #5287
When referenced (Library-linked) Mesh was used by a local Object, and the amount of Materials became less in library, Blender crashed!
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r--source/blender/blenkernel/intern/material.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 47977adbbd7..e54f44075fb 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -404,6 +404,13 @@ Material *give_current_material(Object *ob, int act)
ma= ob->mat[act-1];
}
else { /* in data */
+ short *totcolp= give_totcolp(ob);
+
+ /* check for inconsistancy */
+ if(*totcolp < ob->totcol)
+ ob->totcol= *totcolp;
+ if(act>ob->totcol) act= ob->totcol;
+
matarar= give_matarar(ob);
if(matarar && *matarar) ma= (*matarar)[act-1];