blob: use BLOBMSG_TYPE_STRING as a fallback type for arrays if no type was specified
authorFelix Fietkau <nbd@openwrt.org>
Mon, 2 Dec 2013 10:11:21 +0000 (11:11 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 2 Dec 2013 10:11:21 +0000 (11:11 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
blob.c

diff --git a/blob.c b/blob.c
index 98c8d8a13a1ec627fe55c2510163d49c56088aed..ad72652cfc44092dc31571af71e30618263b10c4 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -105,11 +105,16 @@ __uci_element_to_blob(struct blob_buf *b, struct uci_element *e,
                types |= 1 << attr->type;
 
                if (attr->type == BLOBMSG_TYPE_ARRAY) {
-                       if (!p->info)
-                               continue;
+                       int element_type = 0;
+
+                       if (p->info)
+                               element_type = p->info[i].type;
+
+                       if (!element_type)
+                               element_type = BLOBMSG_TYPE_STRING;
 
                        array = blobmsg_open_array(b, attr->name);
-                       uci_array_to_blob(b, o, p->info[i].type);
+                       uci_array_to_blob(b, o, element_type);
                        blobmsg_close_array(b, array);
                        ret++;
                        continue;