format_items(): Check for NULL pointers.
authorAndre Noll <maan@systemlinux.org>
Sat, 1 Nov 2008 23:31:38 +0000 (00:31 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 1 Nov 2008 23:31:38 +0000 (00:31 +0100)
And return NULL in this case, just as for an empty item list.

format.c

index f6b1f48d102d9762696de1345fd61cdce9c83c28..a3a01ba1ca18b230298f5b349cf8f1737a0d49f6 100644 (file)
--- a/format.c
+++ b/format.c
@@ -401,6 +401,8 @@ char *format_items(struct format_info *info, union atom_value *values)
        int i;
        char *buf = NULL;
 
+       if (!info)
+               return NULL;
        for (i = 0; info->items[i]; i++) {
                struct atom *a;
                struct format_item *fi = info->items[i];