From 69b3c5368c3ea946304b7b63dbbaa61dd04402e8 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Mon, 29 Mar 2021 12:50:05 -0500 Subject: [PATCH] base: Context should optional in more error funcs --- lib/base/error_string.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/base/error_string.c b/lib/base/error_string.c index 5c787ba2c..fba080db7 100644 --- a/lib/base/error_string.c +++ b/lib/base/error_string.c @@ -39,6 +39,8 @@ void heim_clear_error_message(heim_context context) { + if (!context) + return; if (context->error_string) free(context->error_string); context->error_code = 0; @@ -164,7 +166,7 @@ heim_get_error_string(heim_context context) int heim_have_error_string(heim_context context) { - return context->error_string != NULL; + return context && context->error_string != NULL; } void