Skip to content

Commit fb80e04

Browse files
committed
Check sentry to remove unused variable warning
1 parent cdb5c2d commit fb80e04

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

tiny_obj_loader.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -401,20 +401,22 @@ static std::istream &safeGetline(std::istream &is, std::string &t) {
401401
std::istream::sentry se(is, true);
402402
std::streambuf *sb = is.rdbuf();
403403

404-
for (;;) {
405-
int c = sb->sbumpc();
406-
switch (c) {
407-
case '\n':
408-
return is;
409-
case '\r':
410-
if (sb->sgetc() == '\n') sb->sbumpc();
411-
return is;
412-
case EOF:
413-
// Also handle the case when the last line has no line ending
414-
if (t.empty()) is.setstate(std::ios::eofbit);
415-
return is;
416-
default:
417-
t += static_cast<char>(c);
404+
if (se) {
405+
for (;;) {
406+
int c = sb->sbumpc();
407+
switch (c) {
408+
case '\n':
409+
return is;
410+
case '\r':
411+
if (sb->sgetc() == '\n') sb->sbumpc();
412+
return is;
413+
case EOF:
414+
// Also handle the case when the last line has no line ending
415+
if (t.empty()) is.setstate(std::ios::eofbit);
416+
return is;
417+
default:
418+
t += static_cast<char>(c);
419+
}
418420
}
419421
}
420422
}

0 commit comments

Comments
 (0)