🚨 fix UBSAN warning

This commit is contained in:
Niels Lohmann 2022-07-20 18:58:08 +02:00
parent 0f9a2f264e
commit 5fb2b7ec55
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69

View File

@ -335,7 +335,7 @@ TEST_CASE("deserialization")
SECTION("FILE*")
{
std::FILE* f = nullptr;
std::FILE* f = std::fopen("nonexisting_file", "r"); // NOLINT(cppcoreguidelines-owning-memory)
json _;
CHECK_THROWS_WITH_AS(_ = json::parse(f), "[json.exception.parse_error.116] parse error: input file is invalid", json::parse_error&);
CHECK_THROWS_WITH_AS(_ = json::accept(f), "[json.exception.parse_error.116] parse error: input file is invalid", json::parse_error&);