diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_ID.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index cb1137fbe57..420fe319d08 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -320,9 +320,15 @@ static int rna_IDPArray_length(PointerRNA *ptr) int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assign_ptr) { ID *id= ptr->id.data; + short *totcol= give_totcolp_id(id); Material *mat_id= assign_ptr->id.data; - assign_material_id(id, mat_id, key + 1); - return 1; + if(totcol && (key >= 0 && key < *totcol)) { + assign_material_id(id, mat_id, key + 1); + return 1; + } + else { + return 0; + } } #else |