From d884dc46a2d5c409c5e8d442b4eac14f3f0256d5 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 4 Feb 2017 18:41:16 -0600 Subject: [PATCH] libpkgconf: client: ensure error/warn handlers always have a sane default instead of actually NULL --- libpkgconf/client.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libpkgconf/client.c b/libpkgconf/client.c index 8b552bd..3ad2a3a 100644 --- a/libpkgconf/client.c +++ b/libpkgconf/client.c @@ -55,6 +55,8 @@ pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error if (client->error_handler == NULL) client->error_handler = pkgconf_default_error_handler; + client->warn_handler = pkgconf_default_error_handler; + pkgconf_path_build_from_environ("PKG_CONFIG_SYSTEM_LIBRARY_PATH", SYSTEM_LIBDIR, &client->filter_libdirs, false); pkgconf_path_build_from_environ("PKG_CONFIG_SYSTEM_INCLUDE_PATH", SYSTEM_INCLUDEDIR, &client->filter_includedirs, false); @@ -373,6 +375,9 @@ void pkgconf_client_set_warn_handler(pkgconf_client_t *client, pkgconf_error_handler_func_t warn_handler) { client->warn_handler = warn_handler; + + if (client->warn_handler == NULL) + client->warn_handler = pkgconf_default_error_handler; } /* @@ -406,4 +411,7 @@ void pkgconf_client_set_error_handler(pkgconf_client_t *client, pkgconf_error_handler_func_t error_handler) { client->error_handler = error_handler; + + if (client->error_handler == NULL) + client->error_handler = pkgconf_default_error_handler; }