]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
util: Non-existent string array does not contain any string
authorJiri Denemark <jdenemar@redhat.com>
Fri, 19 Jul 2013 12:55:41 +0000 (14:55 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 19 Jul 2013 15:59:47 +0000 (17:59 +0200)
Make virStringArrayHasString return false when called on a non-existent
string array.

src/util/virstring.c

index 1f4850edfdd8f8237a194add764120518865d34f..d11db5cbcc6bab3531f9b89cc560afddf81fbdbf 100644 (file)
@@ -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;