mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-19 12:59:58 +00:00
frontend_common: Set config array size to 0 if the array is ended without changing its index
This commit is contained in:
parent
14398a1cbb
commit
1654b8f9e0
1 changed files with 8 additions and 4 deletions
|
@ -937,15 +937,19 @@ void Config::EndArray() {
|
||||||
// You can't end a config array before starting one
|
// You can't end a config array before starting one
|
||||||
ASSERT(!array_stack.empty());
|
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
|
// Write out the size to config
|
||||||
if (key_stack.size() == 1 && array_stack.back().name.empty()) {
|
if (key_stack.size() == 1 && array_stack.back().name.empty()) {
|
||||||
// Edge-case where the first array created doesn't have a name
|
// Edge-case where the first array created doesn't have a name
|
||||||
config->SetValue(GetSection().c_str(), std::string("size").c_str(),
|
config->SetValue(GetSection().c_str(), std::string("size").c_str(), ToString(size).c_str());
|
||||||
ToString(array_stack.back().size).c_str());
|
|
||||||
} else {
|
} else {
|
||||||
const auto key = GetFullKey(std::string("size"), true);
|
const auto key = GetFullKey(std::string("size"), true);
|
||||||
config->SetValue(GetSection().c_str(), key.c_str(),
|
config->SetValue(GetSection().c_str(), key.c_str(), ToString(size).c_str());
|
||||||
ToString(array_stack.back().size).c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
array_stack.pop_back();
|
array_stack.pop_back();
|
||||||
|
|
Loading…
Reference in a new issue