diff options
author | t895 <clombardo169@gmail.com> | 2023-11-21 21:14:41 +0100 |
---|---|---|
committer | t895 <clombardo169@gmail.com> | 2023-11-21 21:14:41 +0100 |
commit | 1654b8f9e0f9c6260ec73bd1f8076287464a7ee9 (patch) | |
tree | 5bf4da262186280519c85660d662b1aad284c554 /src | |
parent | frontend_common: Manually handle opening config file (diff) | |
download | yuzu-1654b8f9e0f9c6260ec73bd1f8076287464a7ee9.tar yuzu-1654b8f9e0f9c6260ec73bd1f8076287464a7ee9.tar.gz yuzu-1654b8f9e0f9c6260ec73bd1f8076287464a7ee9.tar.bz2 yuzu-1654b8f9e0f9c6260ec73bd1f8076287464a7ee9.tar.lz yuzu-1654b8f9e0f9c6260ec73bd1f8076287464a7ee9.tar.xz yuzu-1654b8f9e0f9c6260ec73bd1f8076287464a7ee9.tar.zst yuzu-1654b8f9e0f9c6260ec73bd1f8076287464a7ee9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/frontend_common/config.cpp | 12 |
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() { // You can't end a config array before starting one ASSERT(!array_stack.empty()); + // Set the array size to 0 if the array is ended without changing the index + int size = 0; + if (array_stack.back().index != 0) { + size = array_stack.back().size; + } + // Write out the size to config if (key_stack.size() == 1 && array_stack.back().name.empty()) { // Edge-case where the first array created doesn't have a name - config->SetValue(GetSection().c_str(), std::string("size").c_str(), - ToString(array_stack.back().size).c_str()); + config->SetValue(GetSection().c_str(), std::string("size").c_str(), ToString(size).c_str()); } else { const auto key = GetFullKey(std::string("size"), true); - config->SetValue(GetSection().c_str(), key.c_str(), - ToString(array_stack.back().size).c_str()); + config->SetValue(GetSection().c_str(), key.c_str(), ToString(size).c_str()); } array_stack.pop_back(); |