[Bf-blender-cvs] [2d7effc27d8] master: Fix segfault when polling `MESH_OT_paint_mask_extract`

Sybren A. Stüvel noreply at git.blender.org
Tue Nov 26 12:12:39 CET 2019


Commit: 2d7effc27d8b893c2e650079203c1451c82d8e5b
Author: Sybren A. Stüvel
Date:   Tue Nov 26 12:12:29 2019 +0100
Branches: master
https://developer.blender.org/rB2d7effc27d8b893c2e650079203c1451c82d8e5b

Fix segfault when polling `MESH_OT_paint_mask_extract`

`CTX_data_active_object(C)` returns `NULL` when there is no active object,
and this was not tested for in the code.

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

M	source/blender/editors/mesh/editmesh_mask_extract.c

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

diff --git a/source/blender/editors/mesh/editmesh_mask_extract.c b/source/blender/editors/mesh/editmesh_mask_extract.c
index 40430bccf16..0d886360253 100644
--- a/source/blender/editors/mesh/editmesh_mask_extract.c
+++ b/source/blender/editors/mesh/editmesh_mask_extract.c
@@ -61,7 +61,7 @@
 static bool paint_mask_extract_poll(bContext *C)
 {
   Object *ob = CTX_data_active_object(C);
-  if (ob->mode == OB_MODE_SCULPT) {
+  if (ob != NULL && ob->mode == OB_MODE_SCULPT) {
     if (ob->sculpt->bm) {
       CTX_wm_operator_poll_msg_set(C, "The mask can not be extracted with dyntopo activated.");
       return false;



More information about the Bf-blender-cvs mailing list