diff options
author | George Vogiatzis <Gvgeo> | 2019-05-23 14:57:03 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-23 16:27:31 +0300 |
commit | 352474ced8e1e7c34b08c20dafd594b92eda6f14 (patch) | |
tree | 2459ae6578d2c67c06159a4618add80638553070 /source/blender/editors/mesh/editmesh_select.c | |
parent | df7f69b8735f440f22404ab65698404deff30ed7 (diff) |
Fix T65002: after hiding edit mode object, clicking in wireframe mode crashes
Differential Revision: https://developer.blender.org/D4926
Diffstat (limited to 'source/blender/editors/mesh/editmesh_select.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index dc94219cb9a..0aa160453b5 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -279,7 +279,7 @@ BMElem *EDBM_select_id_bm_elem_get(struct EDBMSelectID_Context *sel_id_ctx, const uint sel_id, uint *r_base_index) { - char elem_type; + char elem_type = 0; uint elem_id; uint base_index = 0; for (; base_index < sel_id_ctx->bases_len; base_index++) { @@ -504,7 +504,7 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc, } else { struct NearestVertUserData data = {{0}}; - const struct NearestVertUserData_Hit *hit; + const struct NearestVertUserData_Hit *hit = NULL; const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_DEFAULT; BMesh *prev_select_bm = NULL; @@ -549,6 +549,10 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc, } } + if (hit == NULL) { + return NULL; + } + prev_select.index = hit->index; prev_select.elem = hit->vert; prev_select.bm = prev_select_bm; @@ -751,7 +755,7 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc, } else { struct NearestEdgeUserData data = {{0}}; - const struct NearestEdgeUserData_Hit *hit; + const struct NearestEdgeUserData_Hit *hit = NULL; /* interpolate along the edge before doing a clipping plane test */ const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_DEFAULT & ~V3D_PROJ_TEST_CLIP_BB; BMesh *prev_select_bm = NULL; @@ -798,6 +802,10 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc, } } + if (hit == NULL) { + return NULL; + } + if (r_dist_center) { *r_dist_center = hit->dist_center; } @@ -960,7 +968,7 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc, } else { struct NearestFaceUserData data = {{0}}; - const struct NearestFaceUserData_Hit *hit; + const struct NearestFaceUserData_Hit *hit = NULL; const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_DEFAULT; BMesh *prev_select_bm = NULL; @@ -1005,6 +1013,10 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc, } } + if (hit == NULL) { + return NULL; + } + if (r_dist_center) { *r_dist_center = hit->dist; } |