Browse Source

uci: Fix uci_delete() when ptr->value is empty string

After fix for deleting list elements by index this function was
broken and didn't allow to invoke from command line:
uci set some.fancy.list=''
i.e. list wasn't cleared

Signed-off-by: Krzysztof Kuźnik <k.kuznik@avsystem.com>
Krzysztof Kuźnik 11 years ago
parent
commit
b42ee8f218
1 changed files with 1 additions and 1 deletions
  1. 1 1
      list.c

+ 1 - 1
list.c

@@ -559,7 +559,7 @@ int uci_delete(struct uci_context *ctx, struct uci_ptr *ptr)
 
 	UCI_ASSERT(ctx, ptr->s);
 
-	if (ptr->value && ptr->o && ptr->o->type == UCI_TYPE_LIST) {
+	if (ptr->value && *ptr->value && ptr->o && ptr->o->type == UCI_TYPE_LIST) {
 		if (!sscanf(ptr->value, "%d", &index))
 			return 1;