Fix crash when accessing length of material_slots on evaluated Empty object.

`BKE_object_material_count_eval` did not take into account the Empty
object case at all.
This commit is contained in:
Bastien Montagne
2023-05-06 12:25:45 +02:00
parent 60283c63f1
commit bd412c9e71

View File

@@ -759,6 +759,10 @@ Material *BKE_object_material_get_eval(Object *ob, short act)
int BKE_object_material_count_eval(Object *ob)
{
BLI_assert(DEG_is_evaluated_object(ob));
if (ob->type == OB_EMPTY) {
return 0;
}
BLI_assert(ob->data != nullptr);
ID *id = get_evaluated_object_data_with_materials(ob);
const short *len_p = BKE_id_material_len_p(id);
return len_p ? *len_p : 0;