Fix crash: empty lines in m3u files and folder deletion in removeMultiDiskContent

- FileData: Skip lines where trim[0] == '\0' in m3u parsing (empty lines)
- SystemData: Check getType() == GAME before deleting fileMap entries to
  prevent accidentally deleting folder entries that match content file paths

Cherry-picked fixes from ROCKNIX 39fde1086 (adapted to our codebase)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Douglas Teles
2026-04-17 17:12:03 -03:00
parent 8f5a625c88
commit 33f29c5d94
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -911,7 +911,7 @@ std::set<std::string> FileData::getContentFiles()
while (std::getline(m3u, line))
{
auto trim = Utils::String::trim(line);
if (trim[0] == '#' || trim[0] == '\\' || trim[0] == '/')
if (trim[0] == '#' || trim[0] == '\\' || trim[0] == '/' || trim[0] == '\0')
continue;
files.insert(path + "/" + trim);
+1 -1
View File
@@ -197,7 +197,7 @@ void SystemData::removeMultiDiskContent(std::unordered_map<std::string, FileData
for (const auto& file : files)
{
auto it = fileMap.find(file);
if (it != fileMap.cend())
if (it != fileMap.cend() && it->second->getType() == GAME)
{
delete it->second;
fileMap.erase(it);