[Bf-blender-cvs] [a823e825c89] blender-v2.92-release: Fix T84569: crash when trying to bake an object with no faces

Habib Gahbiche noreply at git.blender.org
Wed Jan 20 18:07:58 CET 2021


Commit: a823e825c899c30a98dd1c3fe64c5e3d72716921
Author: Habib Gahbiche
Date:   Wed Jan 20 15:02:04 2021 +0100
Branches: blender-v2.92-release
https://developer.blender.org/rBa823e825c899c30a98dd1c3fe64c5e3d72716921

Fix T84569: crash when trying to bake an object with no faces

Differential Revision: https://developer.blender.org/D10125

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

M	source/blender/editors/object/object_bake_api.c

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

diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 8a63ab22b36..113a0395e8c 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -441,6 +441,12 @@ static bool bake_object_check(ViewLayer *view_layer,
   }
 
   Mesh *me = (Mesh *)ob->data;
+
+  if (me->totpoly == 0) {
+    BKE_reportf(reports, RPT_ERROR, "No faces found in the object \"%s\"", ob->id.name + 2);
+    return false;
+  }
+
   if (target == R_BAKE_TARGET_VERTEX_COLORS) {
     MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR);
     MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_MLOOPCOL);



More information about the Bf-blender-cvs mailing list