Skip to content
Permalink
Browse files Browse the repository at this point in the history
Check the neighbor_index in stl_check_normal_vector
Fixes #60
  • Loading branch information
gladk committed Nov 18, 2022
1 parent 767a105 commit 5fab257
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/normals.c
Expand Up @@ -142,7 +142,8 @@ stl_fix_normal_directions(stl_file *stl) {
}
}
/* If this edge of the facet is connected: */
if(stl->neighbors_start[facet_num].neighbor[j] != -1) {
if(stl->neighbors_start[facet_num].neighbor[j] != -1 &&
stl->neighbors_start[facet_num].neighbor[j] < stl->stats.number_of_facets*sizeof(char)) {
/* If we haven't fixed this facet yet, add it to the list: */
if(norm_sw[stl->neighbors_start[facet_num].neighbor[j]] != 1) {
/* Add node to beginning of list. */
Expand Down

0 comments on commit 5fab257

Please sign in to comment.