Skip to content

Commit

Permalink
Merge pull request #22 from ferdymercury/patch-1
Browse files Browse the repository at this point in the history
Only trim buffer if there is a \0 in it
  • Loading branch information
ferdymercury authored Nov 5, 2020
2 parents 89448e3 + ff26915 commit e90f4a8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/strict_fstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ static std::string strerror()
std::string tmp(p, std::strlen(p));
std::swap(buff, tmp);
#endif
buff.resize(buff.find('\0'));
if(buff.find('\0') != std::string::npos)
{
buff.resize(buff.find('\0'));
}
return buff;
}

Expand Down

0 comments on commit e90f4a8

Please sign in to comment.