From d07c4541273383dabe534c6412b34f6d9a74387c Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 22 Jul 2022 18:56:31 +0200 Subject: [PATCH] :recycle: change behavior for null FILE* --- include/nlohmann/detail/input/input_adapters.hpp | 6 +----- single_include/nlohmann/json.hpp | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/include/nlohmann/detail/input/input_adapters.hpp b/include/nlohmann/detail/input/input_adapters.hpp index bba61abea3..c4b0979030 100644 --- a/include/nlohmann/detail/input/input_adapters.hpp +++ b/include/nlohmann/detail/input/input_adapters.hpp @@ -64,11 +64,7 @@ class file_input_adapter std::char_traits::int_type get_character() noexcept { - if (JSON_HEDLEY_LIKELY(m_file != nullptr)) - { - return std::fgetc(m_file); - } - return std::char_traits::eof(); // LCOV_EXCL_LINE + return std::fgetc(m_file); } private: diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 9c6dbb6b0e..271ff635e4 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -5951,11 +5951,7 @@ class file_input_adapter std::char_traits::int_type get_character() noexcept { - if (JSON_HEDLEY_LIKELY(m_file != nullptr)) - { - return std::fgetc(m_file); - } - return std::char_traits::eof(); // LCOV_EXCL_LINE + return std::fgetc(m_file); } private: