Skip to content

Commit b760557

Browse files
authored
fix some nullable warnings (#1567)
1 parent 5bc713e commit b760557

12 files changed

+20
-20
lines changed

src/JoinRpg.Data.Interfaces/ICharacterRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class GroupHeader : IEquatable<GroupHeader>
5757
public bool Equals(GroupHeader? other) => other != null && CharacterGroupId == other.CharacterGroupId;
5858

5959
/// <inheritdoc />
60-
public override bool Equals(object obj) => Equals(obj as GroupHeader);
60+
public override bool Equals(object? obj) => Equals(obj as GroupHeader);
6161

6262
/// <inheritdoc />
6363
public override int GetHashCode() => CharacterGroupId;

src/JoinRpg.WebPortal.Models/AccommodationPotentialNeighbors.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public enum NeighborType
3333
public class AccommodationPotentialNeighborsComparer : IEqualityComparer<AccommodationPotentialNeighbors>
3434
{
3535

36-
public bool Equals(AccommodationPotentialNeighbors x, AccommodationPotentialNeighbors y)
36+
public bool Equals(AccommodationPotentialNeighbors? x, AccommodationPotentialNeighbors? y)
3737
{
3838
//Check whether the objects are the same object.
3939
if (Object.ReferenceEquals(x, y))

src/JoinRpg.WebPortal.Models/Characters/CharacterGroupListItemViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public int RootGroupId
5454

5555
public bool Equals(CharacterGroupListItemViewModel? other) => other != null && other.CharacterGroupId == CharacterGroupId;
5656

57-
public override bool Equals(object obj) => Equals(obj as CharacterGroupListItemViewModel);
57+
public override bool Equals(object? obj) => Equals(obj as CharacterGroupListItemViewModel);
5858

5959
public override int GetHashCode() => CharacterGroupId;
6060

src/JoinRpg.WebPortal.Models/Characters/CharacterGroupReportItemViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class CharacterGroupReportItemViewModel : IEquatable<CharacterGroupReport
3838

3939
public bool Equals(CharacterGroupReportItemViewModel? other) => other != null && other.CharacterGroupId == CharacterGroupId;
4040

41-
public override bool Equals(object obj) => Equals(obj as CharacterGroupReportItemViewModel);
41+
public override bool Equals(object? obj) => Equals(obj as CharacterGroupReportItemViewModel);
4242

4343
public override int GetHashCode() => CharacterGroupId;
4444

src/JoinRpg.WebPortal.Models/Characters/CharacterTreeViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public class CharacterLinkViewModel : IEquatable<CharacterLinkViewModel>
8484

8585
public bool Equals(CharacterLinkViewModel? other) => other != null && CharacterId == other.CharacterId;
8686

87-
public override bool Equals(object obj) => Equals(obj as CharacterLinkViewModel);
87+
public override bool Equals(object? obj) => Equals(obj as CharacterLinkViewModel);
8888

8989
public override int GetHashCode() => CharacterId;
9090

src/JoinRpg.WebPortal.Models/Characters/CharacterViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class CharacterViewModel :
5252

5353
public bool Equals(CharacterViewModel? other) => other != null && CharacterId == other.CharacterId;
5454

55-
public override bool Equals(object obj) => Equals(obj as CharacterViewModel);
55+
public override bool Equals(object? obj) => Equals(obj as CharacterViewModel);
5656

5757
public override int GetHashCode() => CharacterId;
5858

src/JoinRpg.WebPortal.Models/Claims/ClaimViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ public ClaimFeeViewModel(Claim claim, ClaimViewModel model, int currentUserId)
501501
ProjectId = claim.ProjectId;
502502
FeeVariants = claim.Project.ProjectFeeSettings
503503
.Select(f => f.Fee)
504-
.Union(CurrentFee)
504+
.Append(CurrentFee)
505505
.OrderBy(x => x)
506506
.ToList();
507507
FinanceOperations = claim.FinanceOperations

src/JoinRpg.WebPortal.Models/CustomFieldsViewModels.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class FieldValueViewModel
7373

7474
public bool HasMasterAccess { get; }
7575

76-
public string Value { get; }
76+
public string? Value { get; }
7777

7878
public bool HasValue { get; }
7979

@@ -386,8 +386,8 @@ private FieldValueViewModel CreateFieldValueView(FieldWithValue fv, ILinkRendere
386386
public bool AnythingAccessible => Fields.Any(f => f.CanEdit || f.CanView);
387387

388388
[CanBeNull]
389-
public FieldValueViewModel FieldById(int projectFieldId) => Fields.SingleOrDefault(field => field.ProjectFieldId == projectFieldId);
389+
public FieldValueViewModel? FieldById(int projectFieldId) => Fields.SingleOrDefault(field => field.ProjectFieldId == projectFieldId);
390390
[CanBeNull]
391-
public FieldValueViewModel Field(ProjectField field) => FieldById(field.ProjectFieldId);
391+
public FieldValueViewModel? Field(ProjectField field) => FieldById(field.ProjectFieldId);
392392
}
393393
}

src/JoinRpg.WebPortal.Models/Helpers/FinanceDisplayExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static class FinanceDisplayExtensions
1111
/// <summary>
1212
/// Returns display name of the payment type kind
1313
/// </summary>
14-
public static string GetDisplayName(this PaymentTypeKindViewModel kind, User user, string defaultName = null)
14+
public static string GetDisplayName(this PaymentTypeKindViewModel kind, User? user, string? defaultName = null)
1515
{
1616
switch (kind)
1717
{
@@ -29,7 +29,7 @@ public static string GetDisplayName(this PaymentTypeKindViewModel kind, User use
2929
/// <summary>
3030
/// Returns display name of the payment type kind
3131
/// </summary>
32-
public static string GetDisplayName(this PaymentTypeKind kind, User user, string defaultName = null)
32+
public static string GetDisplayName(this PaymentTypeKind kind, User user, string? defaultName = null)
3333
=> ((PaymentTypeKindViewModel)kind).GetDisplayName(user, defaultName);
3434

3535
/// <summary>

src/JoinRpg.WebPortal.Models/Print/HtmlCardPrintResult.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace JoinRpg.Web.Models.Print
44
{
55
public class HtmlCardPrintResult
66
{
7-
public HtmlCardPrintResult(string html, CardSize cardSize, string backgroundUrl = null)
7+
public HtmlCardPrintResult(string html, CardSize cardSize, string? backgroundUrl = null)
88
{
99
Html = html;
1010
CardSize = cardSize;
@@ -17,8 +17,8 @@ public HtmlCardPrintResult(string html, CardSize cardSize, string backgroundUrl
1717
[PublicAPI]
1818
public CardSize CardSize { get; }
1919

20-
[PublicAPI, CanBeNull]
21-
public string BackgroundUrl { get; }
20+
[PublicAPI]
21+
public string? BackgroundUrl { get; }
2222
}
2323

2424
public enum CardSize

0 commit comments

Comments
 (0)