Skip to content

Commit 3f29e4e

Browse files
authored
Fix: Fixed NullReferenceException in folder.GetThumbnailAsync (#12286)
1 parent d79a72c commit 3f29e4e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Files.App/Data/Items/DriveItem.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,12 @@ public async Task LoadThumbnailAsync(bool isSidebar = false)
248248
{
249249
if (!string.IsNullOrEmpty(DeviceID) && !string.Equals(DeviceID, "network-folder"))
250250
IconData ??= await FileThumbnailHelper.LoadIconWithoutOverlayAsync(DeviceID, 24);
251-
252-
using var thumbnail = await DriveHelpers.GetThumbnailAsync(Root);
253-
IconData ??= await thumbnail.ToByteArrayAsync();
254-
251+
252+
if (Root is not null)
253+
{
254+
using var thumbnail = await DriveHelpers.GetThumbnailAsync(Root);
255+
IconData ??= await thumbnail.ToByteArrayAsync();
256+
}
255257
IconData ??= UIHelpers.GetSidebarIconResourceInfo(Constants.ImageRes.Folder).IconData;
256258
}
257259

0 commit comments

Comments
 (0)