[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/4] util: Non-existent string array does not contain any string



Make virStringArrayHasString return false when called on a non-existent
string array.
---
 src/util/virstring.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virstring.c b/src/util/virstring.c
index 1f4850e..d11db5c 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -172,6 +172,9 @@ virStringArrayHasString(char **strings, const char *needle)
 {
     size_t i = 0;
 
+    if (!strings)
+        return false;
+
     while (strings[i]) {
         if (STREQ(strings[i++], needle))
             return true;
-- 
1.8.3.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]