Fix crash on unreadable root drive
This commit is contained in:
@@ -61,14 +61,23 @@ public class RootDriveInfoService : IRootDriveInfoService
|
|||||||
|
|
||||||
private (DriveInfo Drive, IContainer? Item) GetContainer(DriveInfo rootDriveInfo)
|
private (DriveInfo Drive, IContainer? Item) GetContainer(DriveInfo rootDriveInfo)
|
||||||
{
|
{
|
||||||
var task = Task.Run(
|
var container = Task.Run(
|
||||||
async () => await _localContentProvider.GetItemByNativePathAsync(
|
async () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _localContentProvider.GetItemByNativePathAsync(
|
||||||
new NativePath(rootDriveInfo.RootDirectory.FullName),
|
new NativePath(rootDriveInfo.RootDirectory.FullName),
|
||||||
PointInTime.Present)
|
PointInTime.Present);
|
||||||
);
|
}
|
||||||
task.Wait();
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).GetAwaiter().GetResult();
|
||||||
|
|
||||||
return (rootDriveInfo, task.Result as IContainer);
|
return (rootDriveInfo, container as IContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int GetDriveOrder(DriveType type)
|
private static int GetDriveOrder(DriveType type)
|
||||||
|
|||||||
Reference in New Issue
Block a user