diff options
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_context.c')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 8 |
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; |