diff --git a/src/admesh/stlinit.cpp b/src/admesh/stlinit.cpp index f1be4ac77c..095f7f715a 100644 --- a/src/admesh/stlinit.cpp +++ b/src/admesh/stlinit.cpp @@ -237,7 +237,17 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor } #endif - // Write the facet into memory. + // Write the facet into memory if none of facet vertices is NAN. + bool someone_is_nan = false; + for (size_t j = 0; j < 3; ++j) { + if (isnan(facet.vertex[j](0)) || isnan(facet.vertex[j](1)) || isnan(facet.vertex[j](2))) { + someone_is_nan = true; + break; + } + } + if(someone_is_nan) + continue; + stl->facet_start[i] = facet; stl_facet_stats(stl, facet, first); }