From f36a0f0e1abdb6d3af1c89239f317b37936da146 Mon Sep 17 00:00:00 2001 From: Denis Ollier Date: Wed, 30 May 2018 22:08:07 +0200 Subject: [PATCH] Fix clang static analyzer warning A possible use of null pointer has been identified by clang static analyzer: ../src/util.c:809:8: warning: Null pointer passed as an argument to a 'nonnull' parameter if (strcmp (ver, lver) != 0) { ^~~~~~~~~~~~~~~~~~ 1 warning generated. Add a NULL pointer check to fix the warning. --- src/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index e0f7b0a..a163d14 100644 --- a/src/util.c +++ b/src/util.c @@ -802,7 +802,7 @@ static void color_print_groups (const void *p, printpkgfn f) static void color_print_install_info (const void *p, printpkgfn f, const char *lver, const char *ver) { - if (lver) { + if (lver && ver) { const char *info = f (p, 'r'); if (info && strcmp (info, "local") != 0) { printf (" %s[%s", color(C_INSTALLED), _("installed"));