diff --git a/source/blender/editors/object/editconstraint.c b/source/blender/editors/object/editconstraint.c index 477d04a818b..e3ec72b502c 100644 --- a/source/blender/editors/object/editconstraint.c +++ b/source/blender/editors/object/editconstraint.c @@ -1329,8 +1329,14 @@ static int object_constraint_add_invoke(bContext *C, wmOperator *op, wmEvent *ev /* dummy operator callback */ static int object_constraint_add_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; - + ScrArea *sa= CTX_wm_area(C); + Object *ob; + + if (sa->spacetype == SPACE_BUTS) + ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + else + ob= CTX_data_active_object(C); + if (!ob) return OPERATOR_CANCELLED; @@ -1372,8 +1378,14 @@ static int pose_constraint_add_invoke(bContext *C, wmOperator *op, wmEvent *evt) /* dummy operator callback */ static int pose_constraint_add_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; - + ScrArea *sa= CTX_wm_area(C); + Object *ob; + + if (sa->spacetype == SPACE_BUTS) + ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + else + ob= CTX_data_active_object(C); + if (!ob) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index cd981b7b419..0bc2e310810 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -876,14 +876,17 @@ int file_delete_poll(bContext *C) SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C); struct direntry* file; - if(!sfile->params ) poll= 0; - - if (sfile->params->active_file < 0) { - poll= 0; - } else { - file = filelist_file(sfile->files, sfile->params->active_file); - if (file && S_ISDIR(file->type)) poll= 0; + if (sfile->params) { + if (sfile->params->active_file < 0) { + poll= 0; + } else { + file = filelist_file(sfile->files, sfile->params->active_file); + if (file && S_ISDIR(file->type)) poll= 0; + } } + else + poll= 0; + return poll; }