mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 02:08:52 +01:00
Fixed crash when playlists directory and/or favorites.txt was not available.
This commit is contained in:
parent
0918d9fb96
commit
8f77348251
@ -356,6 +356,12 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info)
|
|||||||
std::string path = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists");
|
std::string path = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists");
|
||||||
dp = opendir(path.c_str());
|
dp = opendir(path.c_str());
|
||||||
|
|
||||||
|
if(dp == NULL)
|
||||||
|
{
|
||||||
|
info->playlists["favorites"] = new std::vector<Item *>();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while((dirp = readdir(dp)) != NULL)
|
while((dirp = readdir(dp)) != NULL)
|
||||||
{
|
{
|
||||||
std::string file = dirp->d_name;
|
std::string file = dirp->d_name;
|
||||||
@ -407,6 +413,12 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closedir(dp);
|
||||||
|
|
||||||
|
if(info->playlists["favorites"] == NULL)
|
||||||
|
{
|
||||||
|
info->playlists["favorites"] = new std::vector<Item *>();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -476,10 +488,7 @@ void CollectionInfoBuilder::ImportRomDirectory(std::string path, CollectionInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dp != NULL)
|
closedir(dp);
|
||||||
{
|
|
||||||
closedir(dp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user