|
Line 0
Link Here
|
|
|
1 |
From a892af7464bb960cae59222fe416dd89f58821c6 Mon Sep 17 00:00:00 2001 |
| 2 |
From: William Pitcock <nenolod@dereferenced.org> |
| 3 |
Date: Thu, 21 Jan 2016 11:08:36 -0500 |
| 4 |
Subject: [PATCH] pkg: tolerate NULL in pkgconf_compare_version() (closes #85) |
| 5 |
|
| 6 |
--- |
| 7 |
libpkgconf/pkg.c | 6 ++++++ |
| 8 |
1 file changed, 6 insertions(+) |
| 9 |
|
| 10 |
diff --git pkg.c pkg.c |
| 11 |
index 076ccff..41b1ee7 100644 |
| 12 |
--- pkg.c |
| 13 |
+++ pkg.c |
| 14 |
@@ -528,6 +528,12 @@ pkgconf_compare_version(const char *a, const char *b) |
| 15 |
bool isnum; |
| 16 |
|
| 17 |
/* optimization: if version matches then it's the same version. */ |
| 18 |
+ if (a == NULL) |
| 19 |
+ return 1; |
| 20 |
+ |
| 21 |
+ if (b == NULL) |
| 22 |
+ return -1; |
| 23 |
+ |
| 24 |
if (!strcasecmp(a, b)) |
| 25 |
return 0; |
| 26 |
|