Browse Source

uci_delete: check ptr->o and its type before checking ptr->value

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau 10 years ago
parent
commit
2fcc6d756f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      list.c

+ 1 - 1
list.c

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