summaryrefslogtreecommitdiff
path: root/src/frontend_common/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend_common/config.cpp')
-rw-r--r--src/frontend_common/config.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/frontend_common/config.cpp b/src/frontend_common/config.cpp
index cf149ec26..40a44ae12 100644
--- a/src/frontend_common/config.cpp
+++ b/src/frontend_common/config.cpp
@@ -937,15 +937,19 @@ void Config::EndArray() {
937 // You can't end a config array before starting one 937 // You can't end a config array before starting one
938 ASSERT(!array_stack.empty()); 938 ASSERT(!array_stack.empty());
939 939
940 // Set the array size to 0 if the array is ended without changing the index
941 int size = 0;
942 if (array_stack.back().index != 0) {
943 size = array_stack.back().size;
944 }
945
940 // Write out the size to config 946 // Write out the size to config
941 if (key_stack.size() == 1 && array_stack.back().name.empty()) { 947 if (key_stack.size() == 1 && array_stack.back().name.empty()) {
942 // Edge-case where the first array created doesn't have a name 948 // Edge-case where the first array created doesn't have a name
943 config->SetValue(GetSection().c_str(), std::string("size").c_str(), 949 config->SetValue(GetSection().c_str(), std::string("size").c_str(), ToString(size).c_str());
944 ToString(array_stack.back().size).c_str());
945 } else { 950 } else {
946 const auto key = GetFullKey(std::string("size"), true); 951 const auto key = GetFullKey(std::string("size"), true);
947 config->SetValue(GetSection().c_str(), key.c_str(), 952 config->SetValue(GetSection().c_str(), key.c_str(), ToString(size).c_str());
948 ToString(array_stack.back().size).c_str());
949 } 953 }
950 954
951 array_stack.pop_back(); 955 array_stack.pop_back();