Fixed regression casusing some rare STL files not to parsed correctly because of lack of the solid name. #2914

This commit is contained in:
Alessandro Ranellucci 2015-06-15 17:17:36 +02:00
parent 6dc3caa8b2
commit be635c69e7

View file

@ -290,7 +290,7 @@ stl_read(stl_file *stl, int first_facet, int first) {
// skip solid/endsolid
// (in this order, otherwise it won't work when they are paired in the middle of a file)
fscanf(stl->fp, "endsolid\n");
fscanf(stl->fp, "solid %*[^\n]\n"); // name might contain spaces so %*s doesn't work
fscanf(stl->fp, "solid%*[^\n]\n"); // name might contain spaces so %*s doesn't work and it also can be empty (just "solid")
if((fscanf(stl->fp, " facet normal %f %f %f\n", &facet.normal.x, &facet.normal.y, &facet.normal.z) + \
fscanf(stl->fp, " outer loop\n") + \