From fd3d292fcf96d193d2d1632cb68ed8a2b84074b4 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Sat, 13 Oct 2018 11:46:46 -0700 Subject: [PATCH] tinyRenderer, remove both \r and \n, not just \n --- examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp b/examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp index ebc986647..115cde02a 100644 --- a/examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp +++ b/examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp @@ -407,7 +407,7 @@ std::string LoadMtl( } if (linebuf.size() > 0) { - if (linebuf[linebuf.size() - 1] == '\n') linebuf.erase(linebuf.size() - 1); + if (linebuf[linebuf.size() - 1] == '\r') linebuf.erase(linebuf.size() - 1); } // Skip if empty line. @@ -417,11 +417,10 @@ std::string LoadMtl( } linebuf = linebuf.substr(0, linebuf.find_last_not_of(" \t") + 1); - // Skip leading space. const char* token = linebuf.c_str(); token += strspn(token, " \t"); - + assert(token); if (token[0] == '\0') continue; // empty line