Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix kh_find to not die if the head is NULL
Baptiste Daroussin committed 9 years ago
commit 7f7324d810510f0d0cdb5d8a28ff65079626c988
parent 13b83fb
1 file changed +5 -3
modified libpkg/private/pkg.h
@@ -206,10 +206,12 @@

#define kh_find(name, h, k, ret) do {			\
	khint_t __k;					\
-
	__k = kh_get(name, h, k);			\
	ret = NULL;					\
-
	if (__k != kh_end(h)) {				\
-
		ret = kh_value(h, __k);			\
+
	if (h != NULL) {				\
+
		__k = kh_get(name, h, k);		\
+
		if (__k != kh_end(h)) {			\
+
			ret = kh_value(h, __k);		\
+
		}					\
	}						\
} while (0)