diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-12 07:25:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-12 07:25:10 +0400 |
commit | 4a364d23629c8dcc66f7a8478153cb4b86fa562f (patch) | |
tree | a42cc70e463380b67671231acbeec5adf41ebacb /source/blender/editors/interface | |
parent | 5600cf9dd92ebf7f256a5996db080c4721779b36 (diff) |
fix for 2 crashes running operators in background mode.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 5 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index aee23626787..6ebfddff5c1 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5492,6 +5492,11 @@ wmOperator *uiContextActiveOperator(const struct bContext *C) ARegion *ar_ctx= CTX_wm_region(C); uiBlock *block; + /* background mode */ + if (ar_ctx == NULL) { + return NULL; + } + /* scan active regions ui */ for(block=ar_ctx->uiblocks.first; block; block=block->next) { if (block->ui_operator) { diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 2a75c2a26c1..b50df29918d 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -458,11 +458,16 @@ static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op)) * - otherwise, up to info (which is what users normally see) */ str = BKE_reports_string(reports, (G.f & G_DEBUG)? RPT_DEBUG : RPT_INFO); - - write_text(txt, str); - MEM_freeN(str); - - return OPERATOR_FINISHED; + + if (str) { + write_text(txt, str); + MEM_freeN(str); + + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } } static void UI_OT_reports_to_textblock(wmOperatorType *ot) |