mirror of https://github.com/PCSX2/pcsx2.git
Mcd-Folder: Prevent crash trying to delete non-existent node.
This commit is contained in:
parent
d6099dd263
commit
34371c070c
|
@ -1919,10 +1919,13 @@ void FolderMemoryCard::DeleteFromIndex(const std::string& filePath, const std::s
|
|||
if (yaml.has_value() && !yaml.value().empty())
|
||||
{
|
||||
ryml::NodeRef index = yaml.value().rootref();
|
||||
index.remove_child(c4::csubstr(entry.data(), entry.length()));
|
||||
|
||||
// Write out the changes
|
||||
SaveYAMLToFile(indexName.c_str(), index);
|
||||
|
||||
if (index.has_child(c4::csubstr(entry.data(), entry.length())))
|
||||
{
|
||||
index.remove_child(c4::csubstr(entry.data(), entry.length()));
|
||||
// Write out the changes
|
||||
SaveYAMLToFile(indexName.c_str(), index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue