Skip to content

Commit f34d494

Browse files
authored
🐛 Achievements list crashed if name is empty.
1 parent 0e1b307 commit f34d494

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/AdminUI/Pages/Achievements.razor

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
Placeholder="Search for an achievement"
2929
Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium"
3030
Class="mt-0"/>
31-
31+
3232
<MudCheckBox @bind-Checked="ShowArchived" Label="Show archived"></MudCheckBox>
3333
</ToolbarContent>
3434
<HeadingTemplate>
@@ -55,7 +55,10 @@
5555
</HeadingTemplate>
5656
<RowTemplate>
5757
<MudTd DataLabel="Code">
58-
<AdminQRCode QRCodeString="@context.Code" Height="100" />
58+
@if (!string.IsNullOrWhiteSpace(context.Code))
59+
{
60+
<AdminQRCode QRCodeString="@context.Code" Height="100" />
61+
}
5962
</MudTd>
6063
<MudTd DataLabel="Name">
6164
@context.Name
@@ -80,7 +83,7 @@
8083
private IEnumerable<AchievementAdminDto> _model = Enumerable.Empty<AchievementAdminDto>();
8184

8285
private IEnumerable<AchievementAdminDto> FilteredAchievementList => _model
83-
.Where(s => s.Name.Contains(_searchString, StringComparison.InvariantCultureIgnoreCase) && (ShowArchived || !s.IsArchived.GetValueOrDefault(false)));
86+
.Where(s => s.Name?.Contains(_searchString, StringComparison.InvariantCultureIgnoreCase) == true && (ShowArchived || !s.IsArchived.GetValueOrDefault(false)));
8487

8588
private bool ShowArchived { get; set; }
8689

0 commit comments

Comments
 (0)