Browse Source

BUG: readMESH stuck in endless loop (#2142)

Co-authored-by: Bryn Lloyd <[email protected]>
Bryn Lloyd 2 years ago
parent
commit
f1981ff873
1 changed files with 1 additions and 1 deletions
  1. 1 1
      include/igl/readMESH.cpp

+ 1 - 1
include/igl/readMESH.cpp

@@ -48,7 +48,7 @@ IGL_INLINE bool igl::readMESH(
     while(still_comments)
     {
       has_line = fgets(line,LINE_MAX,mesh_file) != NULL;
-      still_comments = (line[0] == '#' || line[0] == '\n' || line[0] == '\r');
+      still_comments = has_line && (line[0] == '#' || line[0] == '\n' || line[0] == '\r');
     }
     return has_line;
   };