diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-09 11:31:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-09 11:31:15 +0400 |
commit | aa6d7ebd145ff375a9dc876d33065f80d94accca (patch) | |
tree | 4c9562c2575294c94bd55cb4b3bd25a9e7e793b6 /source/blender/editors/space_buttons | |
parent | 9d0186fc6a5aa0aab36b9a1f52e3cd5e1ac46767 (diff) | |
parent | 8714fb7019e853703ce8b102edac43d84b7bbe14 (diff) |
svn merge ^/trunk/blender -r40720:40872
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 9d2ac3fd8e2..4a2860335fe 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -234,7 +234,7 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture) else if(buttons_context_path_object(path)) { ob= path->ptr[path->len-1].data; - if(ob && ob->type && (ob->type<OB_LAMP)) { + if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) { ma= give_current_material(ob, ob->actcol); RNA_id_pointer_create(&ma->id, &path->ptr[path->len]); path->len++; @@ -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_SUPPORT_MATERIAL(ob->type) && 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; |