Skip to content

Commit

Permalink
Fix: Fixed crash that would occur when trying to display tags (#12764)
Browse files Browse the repository at this point in the history
  • Loading branch information
hishitetsu authored Jun 27, 2023
1 parent 2dcf58a commit 3f50186
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Files.App/Filesystem/FileTagsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static class FileTagsHelper
public static string[] ReadFileTag(string filePath)
{
var tagString = NativeFileOperationsHelper.ReadStringFromFile($"{filePath}:files");
return tagString?.Split(',');
return tagString?.Split(',', StringSplitOptions.RemoveEmptyEntries);
}

public static void WriteFileTag(string filePath, string[] tag)
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Services/Settings/FileTagsSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public TagViewModel GetTagById(string uid)

public IList<TagViewModel> GetTagsByIds(string[] uids)
{
return uids?.Select(x => GetTagById(x)).ToList();
return uids?.Select(x => GetTagById(x)).Where(x => x is not null).ToList();
}

public IEnumerable<TagViewModel> GetTagsByName(string tagName)
Expand Down

0 comments on commit 3f50186

Please sign in to comment.