From e7e4cc5600b5264321c9a972be7d685da2b4a6d2 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 9 Dec 2019 13:27:21 +0100 Subject: [PATCH] Fixed crash while repairing imported model --- src/admesh/connect.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/admesh/connect.cpp b/src/admesh/connect.cpp index d6de6ce6a4..c266c724c4 100644 --- a/src/admesh/connect.cpp +++ b/src/admesh/connect.cpp @@ -601,11 +601,12 @@ void stl_remove_unconnected_facets(stl_file *stl) stl->neighbors_start[facet].which_vertex_not[edge[1]], stl->neighbors_start[facet].which_vertex_not[edge[2]] }; + // Update statistics on edge connectivity. - if (neighbor[0] == -1) - stl_update_connects_remove_1(neighbor[1]); - if (neighbor[1] == -1) - stl_update_connects_remove_1(neighbor[0]); + if ((neighbor[0] == -1) && (neighbor[1] != -1)) + stl_update_connects_remove_1(neighbor[1]); + if ((neighbor[1] == -1) && (neighbor[0] != -1)) + stl_update_connects_remove_1(neighbor[0]); if (neighbor[0] >= 0) { if (neighbor[1] >= 0) {