From 20f15dbaa8ede19fcd6a9ec0d3abd634697f23a3 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Sun, 26 Aug 2007 19:47:45 +0000 Subject: [PATCH] correct when entry doesn't exist but the index does --- libconfig/config_set_indexed_property.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libconfig/config_set_indexed_property.c b/libconfig/config_set_indexed_property.c index e0cee65..ac7b77f 100644 --- a/libconfig/config_set_indexed_property.c +++ b/libconfig/config_set_indexed_property.c @@ -45,11 +45,12 @@ void config_set_indexed_property(char *configuration, { /* yes, we add this property at the end of this indexed field */ - index = config_get_next_property(configuration, last_index, NULL, NULL); - if (index != -1) - index = config_find_entry(configuration + index, index_name, NULL); - if (index == -1) - index = strlen(configuration); + last_index = config_get_next_property(configuration, last_index, NULL, NULL); + if (last_index != -1) + last_index = config_find_entry(configuration + last_index, index_name, NULL); + if (last_index == -1) + last_index = strlen(configuration); + index = last_index; } } else