Add safety against calling GetStableImportPaths when path doesn't exist

This commit is contained in:
Dean Herbert
2022-05-17 16:55:41 +09:00
parent adc7b61240
commit 30fdbc3de0
2 changed files with 16 additions and 4 deletions

View File

@ -24,8 +24,14 @@ namespace osu.Game.Database
/// <summary>
/// Select paths to import from stable where all paths should be absolute. Default implementation iterates all directories in <see cref="ImportFromStablePath"/>.
/// </summary>
protected virtual IEnumerable<string> GetStableImportPaths(Storage storage) => storage.GetDirectories(ImportFromStablePath)
.Select(path => storage.GetFullPath(path));
protected virtual IEnumerable<string> GetStableImportPaths(Storage storage)
{
if (!storage.ExistsDirectory(ImportFromStablePath))
return Enumerable.Empty<string>();
return storage.GetDirectories(ImportFromStablePath)
.Select(path => storage.GetFullPath(path));
}
protected readonly IModelImporter<TModel> Importer;