Browse Source

blob: use BLOBMSG_TYPE_STRING as a fallback type for arrays if no type was specified

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau 10 years ago
parent
commit
262fede3e8
1 changed files with 8 additions and 3 deletions
  1. 8 3
      blob.c

+ 8 - 3
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;