If an hash does not have the requested key, just error out cleanly instead of crashing when trying to compare a null string. --- tests/c-api/tests-main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/c-api/tests-main.c b/tests/c-api/tests-main.c index 49d36b9..e2e86f5 100644 --- a/tests/c-api/tests-main.c +++ b/tests/c-api/tests-main.c @@ -321,6 +321,11 @@ check_hash (char **ret, const char *key, const char *expected) { const char *value = get_key (ret, key); + if (value == NULL) { + fprintf (stderr, "test failed: hash key %s not found\n", key); + return -1; + } + if (STRNEQ (value, expected)) { fprintf (stderr, "test failed: hash key %s = \"%s\" is not expected value \"%s\"\n", key, value, expected); -- 1.9.3