Skip to content

Commit

Permalink
♻️ change behavior for null FILE*
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Jul 22, 2022
1 parent 5a97913 commit d07c454
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions include/nlohmann/detail/input/input_adapters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@ class file_input_adapter

std::char_traits<char>::int_type get_character() noexcept
{
if (JSON_HEDLEY_LIKELY(m_file != nullptr))
{
return std::fgetc(m_file);
}
return std::char_traits<char>::eof(); // LCOV_EXCL_LINE
return std::fgetc(m_file);
}

private:
Expand Down
6 changes: 1 addition & 5 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5951,11 +5951,7 @@ class file_input_adapter

std::char_traits<char>::int_type get_character() noexcept
{
if (JSON_HEDLEY_LIKELY(m_file != nullptr))
{
return std::fgetc(m_file);
}
return std::char_traits<char>::eof(); // LCOV_EXCL_LINE
return std::fgetc(m_file);
}

private:
Expand Down

0 comments on commit d07c454

Please sign in to comment.