Skip to content

Commit 8a229b2

Browse files
authored
Fix: Fixed crash that would sometimes occur when pinning folders to the sidebar (#11140)
1 parent 55f8a5e commit 8a229b2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Files.App/ServicesImplementation/QuickAccessService.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using Files.App.Controllers;
2-
using Files.App.DataModels;
3-
using Files.App.Filesystem;
4-
using Files.App.Shell;
1+
using Files.App.Shell;
52
using Files.Shared.Extensions;
63
using System;
74
using System.Collections.Generic;
@@ -20,7 +17,9 @@ public async Task<List<string>> GetPinnedFoldersAsync()
2017
.Where(link => link.IsFolder)
2118
.Select(link => link.FilePath).ToList();
2219

23-
sidebarItems.RemoveRange(sidebarItems.Count - 4, 4); // 4 is the number of recent items shown in explorer sidebar
20+
if (sidebarItems.Count > 4) // Avoid first opening crash #11139
21+
sidebarItems.RemoveRange(sidebarItems.Count - 4, 4); // 4 is the number of recent items shown in explorer sidebar
22+
2423
return sidebarItems;
2524
}
2625

0 commit comments

Comments
 (0)