Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fixed issue were removing a tag after changing the layout would cause a crash #12839

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Files.App/Filesystem/ListedItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public string[] FileTags
}
}

public IList<TagViewModel> FileTagsUI
public IList<TagViewModel>? FileTagsUI
{
get => fileTagsSettingsService.GetTagsByIds(FileTags);
}
Expand Down
6 changes: 4 additions & 2 deletions src/Files.App/Services/Settings/FileTagsSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ public TagViewModel GetTagById(string uid)
return tag;
}

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

public IEnumerable<TagViewModel> GetTagsByName(string tagName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface IFileTagsSettingsService : IBaseSettingsService

TagViewModel GetTagById(string uid);

IList<TagViewModel> GetTagsByIds(string[] uids);
IList<TagViewModel>? GetTagsByIds(string[] uids);

IEnumerable<TagViewModel> GetTagsByName(string tagName);

Expand Down