♻️ change behavior for null FILE*

This commit is contained in:
Niels Lohmann 2022-07-22 18:56:31 +02:00
parent 5a97913e93
commit d07c454127
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
2 changed files with 2 additions and 10 deletions

View File

@ -63,13 +63,9 @@ class file_input_adapter
~file_input_adapter() = default; ~file_input_adapter() = default;
std::char_traits<char>::int_type get_character() noexcept std::char_traits<char>::int_type get_character() noexcept
{
if (JSON_HEDLEY_LIKELY(m_file != nullptr))
{ {
return std::fgetc(m_file); return std::fgetc(m_file);
} }
return std::char_traits<char>::eof(); // LCOV_EXCL_LINE
}
private: private:
/// the file pointer to read from /// the file pointer to read from

View File

@ -5950,13 +5950,9 @@ class file_input_adapter
~file_input_adapter() = default; ~file_input_adapter() = default;
std::char_traits<char>::int_type get_character() noexcept std::char_traits<char>::int_type get_character() noexcept
{
if (JSON_HEDLEY_LIKELY(m_file != nullptr))
{ {
return std::fgetc(m_file); return std::fgetc(m_file);
} }
return std::char_traits<char>::eof(); // LCOV_EXCL_LINE
}
private: private:
/// the file pointer to read from /// the file pointer to read from