From 2c3d81d4a7e3888632537140aae57940159fb39e Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Wed, 22 Jan 2014 00:14:04 +0100 Subject: [PATCH] DEFINE_STRING_TABLE_LOOKUP: return _INVALID_* rather than assert on NULL string --- src/shared/util.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/util.h b/src/shared/util.h index ebc765da3..d6d746bc6 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -295,7 +295,8 @@ static inline uint32_t random_u32(void) { } \ scope type name##_from_string(const char *s) { \ type i; \ - assert(s); \ + if (!s) \ + return (type) -1; \ for (i = 0; i < (type)ELEMENTSOF(name##_table); i++) \ if (name##_table[i] && \ streq(name##_table[i], s)) \ -- 2.30.2