Skip to content

Commit 67aee2a

Browse files
authored
Fix crash when connecting certain drives (#1847)
1 parent 71ada6e commit 67aee2a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Files/Filesystem/Drives.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ private async void DeviceAdded(DeviceWatcher sender, DeviceInformation args)
131131
{
132132
root = StorageDevice.FromId(deviceId);
133133
}
134-
catch (UnauthorizedAccessException)
134+
catch (Exception ex) when (
135+
ex is UnauthorizedAccessException
136+
|| ex is ArgumentException)
135137
{
136-
Logger.Warn($"UnauthorizedAccessException: Attemting to add the device, {args.Name}, failed at the StorageFolder initialization step. This device will be ignored. Device ID: {args.Id}");
138+
Logger.Warn($"{ex.GetType()}: Attemting to add the device, {args.Name}, failed at the StorageFolder initialization step. This device will be ignored. Device ID: {args.Id}");
137139
return;
138140
}
139141

0 commit comments

Comments
 (0)