fix for 2 crashes running operators in background mode.

This commit is contained in:
Campbell Barton 2011-12-12 03:25:10 +00:00
parent 5600cf9dd9
commit 4a364d2362
2 changed files with 15 additions and 5 deletions

@ -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) {

@ -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)