Browse Source

Fix bug in readSTL (#1638)

* Fix bug in readSTL

reset the position of the current character in the input

* Move seekg into the inside of if ... else ... block
Kazutaka Nakashima 5 years ago
parent
commit
0a92f2cdb2
1 changed files with 2 additions and 0 deletions
  1. 2 0
      include/igl/readSTL.cpp

+ 2 - 0
include/igl/readSTL.cpp

@@ -49,9 +49,11 @@ IGL_INLINE bool is_stl_binary(std::istream &input) {
   char header[HEADER_SIZE];
   char header[HEADER_SIZE];
   input.read(header, HEADER_SIZE);
   input.read(header, HEADER_SIZE);
   if (!starts_with(header, "solid")) {
   if (!starts_with(header, "solid")) {
+    input.seekg(start_pos);
     return true;
     return true;
   }
   }
   if (!input.good()) {
   if (!input.good()) {
+    input.seekg(start_pos);
     return false;
     return false;
   }
   }