]> git.notmuchmail.org Git - notmuch/blobdiff - json.c
json: Avoid calling strlen(NULL)
[notmuch] / json.c
diff --git a/json.c b/json.c
index 1d0c169449657c49970390ebf76cf98ce11be2e8..3fd923ca787cf62ba3ea4788d976212beb981dba 100644 (file)
--- a/json.c
+++ b/json.c
@@ -105,5 +105,8 @@ json_quote_chararray(const void *ctx, const char *str, const size_t len)
 char *
 json_quote_str(const void *ctx, const char *str)
 {
+    if (str == NULL)
+       str = "";
+
     return (json_quote_chararray (ctx, str, strlen (str)));
 }