[Bf-blender-cvs] [868a6797e0d] master: Fix T62377: Crash hiding Armature in edit mode and switching to pose

Dalai Felinto noreply at git.blender.org
Tue Mar 12 22:49:38 CET 2019


Commit: 868a6797e0d32f48f1238b8bcc2f483dc21c4412
Author: Dalai Felinto
Date:   Tue Mar 12 18:03:31 2019 -0300
Branches: master
https://developer.blender.org/rB868a6797e0d32f48f1238b8bcc2f483dc21c4412

Fix T62377: Crash hiding Armature in edit mode and switching to pose

The poll function accepts hidden objects, so they are not stuck in pose
mode, but the operator itself expects a valid base, which we don't have.

When called from OBJECT_OT_mode_set() it will fallback to object mode.

It is the same that happens when in Edit Mesh mode with a hidden active
object and trying to change to Vertex Painting mode.

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

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

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

diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 9048b786044..977f5f30d94 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -735,6 +735,12 @@ static int posemode_exec(bContext *C, wmOperator *op)
 {
 	struct wmMsgBus *mbus = CTX_wm_message_bus(C);
 	Base *base = CTX_data_active_base(C);
+
+	/* If the base is NULL it means we have an active object, but the object itself is hidden. */
+	if (base == NULL) {
+		return OPERATOR_CANCELLED;
+	}
+
 	Object *obact = base->object;
 	const int mode_flag = OB_MODE_POSE;
 	bool is_mode_set = (obact->mode & mode_flag) != 0;



More information about the Bf-blender-cvs mailing list