From a892af7464bb960cae59222fe416dd89f58821c6 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 21 Jan 2016 11:08:36 -0500 Subject: [PATCH] pkg: tolerate NULL in pkgconf_compare_version() (closes #85) --- libpkgconf/pkg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index 076ccff..41b1ee7 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -528,6 +528,12 @@ pkgconf_compare_version(const char *a, const char *b) bool isnum; /* optimization: if version matches then it's the same version. */ + if (a == NULL) + return 1; + + if (b == NULL) + return -1; + if (!strcasecmp(a, b)) return 0;