mirror of
https://github.com/nlohmann/json.git
synced 2025-07-13 20:21:48 +03:00
🐛 parsing erroneous files yields an exception (#366)
This commit is contained in:
@ -7597,6 +7597,12 @@ class basic_json
|
||||
explicit lexer(std::istream& s)
|
||||
: m_stream(&s), m_line_buffer()
|
||||
{
|
||||
// immediately abort if stream is erroneous
|
||||
if (s.fail())
|
||||
{
|
||||
throw std::invalid_argument("stream error: " + std::string(strerror(errno)));
|
||||
}
|
||||
|
||||
// fill buffer
|
||||
fill_line_buffer();
|
||||
|
||||
|
Reference in New Issue
Block a user