From 5d1d447c2b1c18fd0637da77b4e67d85ce8f65e8 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 7 Mar 2024 15:43:47 +0100 Subject: [PATCH] Fix #114552: Copy material to selected crash on object lacking slot Caused by 9c1da81a4c. This happened in the case where objects shared the same data and slots are assigned to object and receiving object did not have a material slot yet. Then, `ob->matbits` may be NULL, now just check for this, too. Pull Request: https://projects.blender.org/blender/blender/pulls/119161 --- source/blender/blenkernel/intern/material.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/material.cc b/source/blender/blenkernel/intern/material.cc index 7c79cb46268..6f33d35c850 100644 --- a/source/blender/blenkernel/intern/material.cc +++ b/source/blender/blenkernel/intern/material.cc @@ -1249,7 +1249,7 @@ void BKE_object_material_array_assign( /* now we have the right number of slots */ for (int i = 0; i < totcol; i++) { - if (to_object_only && ob->matbits[i] == 0) { + if (to_object_only && ob->matbits && ob->matbits[i] == 0) { /* If we only assign to object, and that slot uses obdata material, do nothing. */ continue; }