diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-05 18:33:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-05 18:33:55 +0400 |
commit | ef457d599467ac9211bb9e3dc218e5c40f5a6a9a (patch) | |
tree | c85afa73ea1752c3e0db66d08e9065e49e263ca0 /source/blender | |
parent | 25cbd13d22218e307ca09e343b3f7e6e9f21a095 (diff) |
fix [#34118] Crash, when clicking "Assign image to UV Map"
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 1d13aa36a6b..3b7517d3987 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -575,13 +575,19 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); - Base *base = ED_view3d_give_base_under_cursor(C, event->mval); + Base *base; Image *ima = NULL; Mesh *me; Object *obedit; int exitmode = 0; - char name[MAX_ID_NAME - 2]; + if (v3d == NULL) { + BKE_report(op->reports, RPT_ERROR, "No 3D View Available"); + return OPERATOR_CANCELLED; + } + + base = ED_view3d_give_base_under_cursor(C, event->mval); + /* Check context */ if (base == NULL || base->object->type != OB_MESH) { BKE_report(op->reports, RPT_ERROR, "Not an object or mesh"); @@ -596,6 +602,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) ima = BKE_image_load_exists(path); } else { + char name[MAX_ID_NAME - 2]; RNA_string_get(op->ptr, "name", name); ima = (Image *)BKE_libblock_find_name(ID_IM, name); } |