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>2011-10-03 20:55:00 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-03 20:55:00 +0400
commit75621eeff97d5765ecd3cdea1873d5c40baad0d6 (patch)
tree851c3067cf35d6b9d1cfb53b0e20467dd4c50a7d /source/blender/editors/space_buttons
parente5a11dfcd670f45a467a84b362c7d189cd011fab (diff)
fix [#27526] shared data but different data materials.
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 9d2ac3fd8e2..526859cecd2 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -721,8 +721,12 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
if(ptr) {
Object *ob= ptr->data;
- if(ob && ob->type && (ob->type<OB_LAMP) && ob->totcol)
- CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, ob->mat+ob->actcol-1);
+ if(ob && ob->type && (ob->type<OB_LAMP) && ob->totcol) {
+ /* a valid actcol isn't ensured [#27526] */
+ int matnr= ob->actcol-1;
+ if(matnr < 0) matnr= 0;
+ CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, &ob->mat[matnr]);
+ }
}
return 1;