Fix #116325: crash assigning non-valid material.paint_active_slot
#116345
@ -1638,6 +1638,14 @@ static bool texpaint_slot_node_find_cb(bNode *node, void *userdata)
|
||||
|
||||
bNode *BKE_texpaint_slot_material_find_node(Material *ma, short texpaint_slot)
|
||||
{
|
||||
if (ma->texpaintslot == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (texpaint_slot >= ma->tot_slots) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TexPaintSlot *slot = &ma->texpaintslot[texpaint_slot];
|
||||
FindTexPaintNodeData find_data = {slot, nullptr};
|
||||
ntree_foreach_texnode_recursive(ma->nodetree,
|
||||
|
@ -163,7 +163,7 @@ static void rna_Material_active_paint_texture_index_update(bContext *C, PointerR
|
||||
}
|
||||
}
|
||||
|
||||
if (ma->texpaintslot) {
|
||||
if (ma->texpaintslot && (ma->tot_slots > ma->paint_active_slot)) {
|
||||
TexPaintSlot *slot = &ma->texpaintslot[ma->paint_active_slot];
|
||||
Image *image = slot->ima;
|
||||
if (image) {
|
||||
|
Loading…
Reference in New Issue
Block a user