diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-03-13 00:03:31 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-03-13 00:47:59 +0300 |
commit | 868a6797e0d32f48f1238b8bcc2f483dc21c4412 (patch) | |
tree | 706648967d6990aef70bb82343132c24731ac264 /source/blender/editors/object | |
parent | 41cb5658803bf3b96f18e93c74c6af66ecdb1e83 (diff) |
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.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; |