aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShane Loretz <sloretz@osrfoundation.org>2017-06-01 14:05:03 -0700
committerShane Loretz <sloretz@osrfoundation.org>2017-06-01 14:05:03 -0700
commitfb80e0421275403a929743cad86b71de7ffd646e (patch)
tree197826010d8c4f657ea28c18f15d0745d6b363ca
parentcdb5c2d37558a65cd144201b4fd8534e027f94f4 (diff)
downloadtinyobjloader-fb80e0421275403a929743cad86b71de7ffd646e.tar.gz
Check sentry to remove unused variable warning
-rw-r--r--tiny_obj_loader.h30
1 files changed, 16 insertions, 14 deletions
diff --git a/tiny_obj_loader.h b/tiny_obj_loader.h
index 3c80145..1006070 100644
--- a/tiny_obj_loader.h
+++ b/tiny_obj_loader.h
@@ -401,20 +401,22 @@ static std::istream &safeGetline(std::istream &is, std::string &t) {
std::istream::sentry se(is, true);
std::streambuf *sb = is.rdbuf();
- for (;;) {
- int c = sb->sbumpc();
- switch (c) {
- case '\n':
- return is;
- case '\r':
- if (sb->sgetc() == '\n') sb->sbumpc();
- return is;
- case EOF:
- // Also handle the case when the last line has no line ending
- if (t.empty()) is.setstate(std::ios::eofbit);
- return is;
- default:
- t += static_cast<char>(c);
+ if (se) {
+ for (;;) {
+ int c = sb->sbumpc();
+ switch (c) {
+ case '\n':
+ return is;
+ case '\r':
+ if (sb->sgetc() == '\n') sb->sbumpc();
+ return is;
+ case EOF:
+ // Also handle the case when the last line has no line ending
+ if (t.empty()) is.setstate(std::ios::eofbit);
+ return is;
+ default:
+ t += static_cast<char>(c);
+ }
}
}
}