X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fdevsparts.c;h=c8f0256a351cdb0f69375ddf32f801f120898d12;hb=6cdd349e6964636c2b7ae71453dca33716dda486;hp=1781def3feb9ac876011328a490def77d2ff7b63;hpb=ffd4820ffe953b0583e3a9357e37d74bed3a2320;p=libguestfs.git diff --git a/daemon/devsparts.c b/daemon/devsparts.c index 1781def..c8f0256 100644 --- a/daemon/devsparts.c +++ b/daemon/devsparts.c @@ -105,8 +105,9 @@ foreach_block_device (block_dev_func_t func) return NULL; } - /* Sort the devices */ - sort_strings (r, size); + /* Sort the devices. Note that r might be NULL if there are no devices. */ + if (r != NULL) + sort_strings (r, size); /* NULL terminate the list */ if (add_string (&r, &size, &alloc, NULL) == -1) {