[Bf-blender-cvs] [9e94135f179] master: Fix: Crash after mesh color attribute name commit

Christophe Hery noreply at git.blender.org
Fri Dec 16 16:45:10 CET 2022


Commit: 9e94135f17906c64e8306e893cd76dbef59dda15
Author: Christophe Hery
Date:   Fri Dec 16 09:42:30 2022 -0600
Branches: master
https://developer.blender.org/rB9e94135f17906c64e8306e893cd76dbef59dda15

Fix: Crash after mesh color attribute name commit

6514bb05ea5a138d8971 missed a null check when accessing the active
and default color attribute names, since the CustomData API does not
do that check itself.

===================================================================

M	source/blender/blenkernel/intern/mesh_legacy_convert.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index a53b0e66924..28bbc0ffae3 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -544,11 +544,15 @@ static void update_active_fdata_layers(Mesh &mesh, CustomData *fdata, CustomData
   }
 
   if (CustomData_has_layer(ldata, CD_PROP_BYTE_COLOR)) {
-    act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.active_color_attribute);
-    CustomData_set_layer_active(fdata, CD_MCOL, act);
+    if (mesh.active_color_attribute != NULL) {
+      act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.active_color_attribute);
+      CustomData_set_layer_active(fdata, CD_MCOL, act);
+    }
 
-    act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.default_color_attribute);
-    CustomData_set_layer_render(fdata, CD_MCOL, act);
+    if (mesh.default_color_attribute != NULL) {
+      act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.default_color_attribute);
+      CustomData_set_layer_render(fdata, CD_MCOL, act);
+    }
 
     act = CustomData_get_clone_layer(ldata, CD_PROP_BYTE_COLOR);
     CustomData_set_layer_clone(fdata, CD_MCOL, act);



More information about the Bf-blender-cvs mailing list