]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/string-table.h
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / basic / string-table.h
index d88625fca73664537766be2734798233a48678f5..4306b90f46d8e75c6e6aa6ae3ff384a52a7103d6 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
 
 #pragma once
 
@@ -48,6 +49,8 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k
 #define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name,type,yes,scope) \
         scope type name##_from_string(const char *s) {                  \
                 int b;                                                  \
+                if (!s)                                                 \
+                        return -1;                                      \
                 b = parse_boolean(s);                                   \
                 if (b == 0)                                             \
                         return (type) 0;                                \