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>2007-03-20 18:34:00 +0300
committerTon Roosendaal <ton@blender.org>2007-03-20 18:34:00 +0300
commite706ce02287e623f3d7078b010698d20b92523ca (patch)
tree9cbe26210d99b273e7ddc818a4948f06098000d0 /source/blender/blenkernel/intern/material.c
parentc10c71909e87c9a01178591f747bc976ce22d77a (diff)
The function to get a Material didn't correctly check for object types.
(bug reported by Campbell via irc)
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r--source/blender/blenkernel/intern/material.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 06f61049269..42a70bb71a9 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -368,7 +368,7 @@ Material ***give_matarar(Object *ob)
mb= ob->data;
return &(mb->mat);
}
- return 0;
+ return NULL;
}
short *give_totcolp(Object *ob)
@@ -389,15 +389,19 @@ short *give_totcolp(Object *ob)
mb= ob->data;
return &(mb->totcol);
}
- return 0;
+ return NULL;
}
Material *give_current_material(Object *ob, int act)
{
Material ***matarar, *ma;
+ short *totcolp;
+
+ if(ob==NULL) return NULL;
- if(ob==NULL) return 0;
- if(ob->totcol==0) return 0;
+ /* if object cannot have material, totcolp==NULL */
+ totcolp= give_totcolp(ob);
+ if(totcolp==NULL || ob->totcol==0) return NULL;
if(act>ob->totcol) act= ob->totcol;
else if(act<=0) act= 1;
@@ -406,7 +410,6 @@ 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)