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

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

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]