[Bf-blender-cvs] [352474ced8e] master: Fix T65002: after hiding edit mode object, clicking in wireframe mode crashes

George Vogiatzis noreply at git.blender.org
Thu May 23 15:28:36 CEST 2019


Commit: 352474ced8e1e7c34b08c20dafd594b92eda6f14
Author: George Vogiatzis
Date:   Thu May 23 13:57:03 2019 +0200
Branches: master
https://developer.blender.org/rB352474ced8e1e7c34b08c20dafd594b92eda6f14

Fix T65002: after hiding edit mode object, clicking in wireframe mode crashes

Differential Revision: https://developer.blender.org/D4926

===================================================================

M	source/blender/editors/mesh/editmesh_select.c

===================================================================

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;
     }



More information about the Bf-blender-cvs mailing list