Skip to content

Commit

Permalink
fix: check for nullptr before calling strlen
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrechette committed Oct 8, 2023
1 parent 16cf2de commit ce26fd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/sources/test_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using namespace sjson;

static Parser parser_from_c_str(const char* c_str)
{
return Parser(c_str, std::strlen(c_str));
return Parser(c_str, c_str != nullptr ? std::strlen(c_str) : 0);
}

TEST_CASE("Parser Misc", "[parser]")
Expand Down

0 comments on commit ce26fd7

Please sign in to comment.