fix for crash with textbox add poll function, missing NULL check.
This commit is contained in:
@@ -1373,16 +1373,6 @@ void FONT_OT_text_insert(wmOperatorType *ot)
|
||||
|
||||
|
||||
/*********************** textbox add operator *************************/
|
||||
static int textbox_poll(bContext *C)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
if (!ED_operator_object_active_editable(C) ) return 0;
|
||||
if (ob->type != OB_FONT) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int textbox_add_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_active_object(C);
|
||||
@@ -1409,8 +1399,8 @@ void FONT_OT_textbox_add(wmOperatorType *ot)
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= textbox_add_exec;
|
||||
ot->poll= textbox_poll;
|
||||
|
||||
ot->poll= ED_operator_object_active_editable_font;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
@@ -1452,7 +1442,7 @@ void FONT_OT_textbox_remove(wmOperatorType *ot)
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= textbox_remove_exec;
|
||||
ot->poll= textbox_poll;
|
||||
ot->poll= ED_operator_object_active_editable_font;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
@@ -154,6 +154,7 @@ int ED_operator_console_active(struct bContext *C);
|
||||
int ED_operator_object_active(struct bContext *C);
|
||||
int ED_operator_object_active_editable(struct bContext *C);
|
||||
int ED_operator_object_active_editable_mesh(struct bContext *C);
|
||||
int ED_operator_object_active_editable_font(struct bContext *C);
|
||||
int ED_operator_editmesh(struct bContext *C);
|
||||
int ED_operator_editmesh_view3d(struct bContext *C);
|
||||
int ED_operator_editmesh_region_view3d(struct bContext *C);
|
||||
|
@@ -282,6 +282,12 @@ int ED_operator_object_active_editable_mesh(bContext *C)
|
||||
return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->type == OB_MESH);
|
||||
}
|
||||
|
||||
int ED_operator_object_active_editable_font(bContext *C)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->type == OB_FONT);
|
||||
}
|
||||
|
||||
int ED_operator_editmesh(bContext *C)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
|
Reference in New Issue
Block a user