diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-01 18:29:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-01 18:29:24 +0400 |
commit | 7fd1bd18e5705f33ddcf0458a4bef0eaa3da92d4 (patch) | |
tree | 707d20787892bde390bf0bbfc7b6dea6091a68de /source/blender/editors/space_image | |
parent | 8a1a4a453dd3cca0319ca88dbab271089d178c20 (diff) |
fix crash when polling image sample outside image space.
also remove historic comment which isnt helpful.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 8376a0bf0d3..aa44caac0af 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -203,21 +203,27 @@ int space_image_main_area_not_uv_brush_poll(bContext *C) return 0; } -static int space_image_image_sample_poll(bContext *C) +static int image_sample_poll(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); - Object *obedit = CTX_data_edit_object(C); - ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings; + if (sima) { + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + ToolSettings *toolsettings = scene->toolsettings; + + if (obedit) { + if (ED_space_image_show_uvedit(sima, obedit) && (toolsettings->use_uv_sculpt)) + return FALSE; + } + else if (sima->mode != SI_MODE_VIEW) { + return FALSE; + } - if (obedit) { - if (ED_space_image_show_uvedit(sima, obedit) && (toolsettings->use_uv_sculpt)) - return 0; + return space_image_main_area_poll(C); } - else if (sima->mode != SI_MODE_VIEW) { - return 0; + else { + return FALSE; } - - return space_image_main_area_poll(C); } /********************** view pan operator *********************/ @@ -2113,7 +2119,7 @@ void IMAGE_OT_sample(wmOperatorType *ot) ot->invoke = image_sample_invoke; ot->modal = image_sample_modal; ot->cancel = image_sample_cancel; - ot->poll = space_image_image_sample_poll; + ot->poll = image_sample_poll; /* flags */ ot->flag = OPTYPE_BLOCKING; |