diff --git a/wrap/io_trimesh/import_obj.h b/wrap/io_trimesh/import_obj.h index 28d3d1ff..b1d901ad 100644 --- a/wrap/io_trimesh/import_obj.h +++ b/wrap/io_trimesh/import_obj.h @@ -643,9 +643,9 @@ public: } } } - while (( line.length()==0 || line[0] == '#') && !stream.eof()); // skip comments and empty lines + while (( line.empty() || (!line.empty() && line[0] == '#')) && !stream.eof()); // skip comments and empty lines - if ( (line.length() == 0)||(line[0] == '#') ) // can be true only on last line of file + if ( (line.length() == 0)||(!line.empty() && line[0] == '#') ) // can be true only on last line of file return; size_t from = 0;