Skip to content

Commit 8de2f0c

Browse files
committed
Cast to DriveItem to check DeviceID
1 parent 6f68c3c commit 8de2f0c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Files.App/Data/Models/DrivesViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private void Watcher_DeviceRemoved(object? sender, string e)
6363
logger.LogInformation($"Drive removed: {e}");
6464
lock (Drives)
6565
{
66-
var drive = Drives.FirstOrDefault(x => x.Id == e);
66+
var drive = Drives.FirstOrDefault(x => (x as DriveItem)?.DeviceID == e);
6767
if (drive is not null)
6868
Drives.Remove(drive);
6969
}
@@ -78,7 +78,7 @@ private void Watcher_DeviceAdded(object? sender, IFolder e)
7878
{
7979
// If drive already in list, remove it first.
8080
var matchingDrive = Drives.FirstOrDefault(x =>
81-
x.Id == e.Id ||
81+
(x as DriveItem)?.DeviceID == (e as DriveItem)?.DeviceID ||
8282
string.IsNullOrEmpty(e.Id)
8383
? x.Id.Contains(e.Name, StringComparison.OrdinalIgnoreCase)
8484
: Path.GetFullPath(x.Id) == Path.GetFullPath(e.Id)

0 commit comments

Comments
 (0)