summaryrefslogtreecommitdiffstats
path: root/daemon/devsparts.c
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/devsparts.c')
-rw-r--r--daemon/devsparts.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index 1781def3..c8f0256a 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) {