Improve null checking for badly set properties in NamePlateGui (#2245)

This commit is contained in:
nebel 2025-04-15 02:54:53 +09:00 committed by GitHub
parent 2787e37548
commit 708f3d0ab2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -53,7 +53,7 @@ public class NamePlateQuotedParts(NamePlateStringField field, bool isFreeCompany
return;
var sb = new SeStringBuilder();
if (this.OuterWrap is { Item1: var outerLeft })
if (this.OuterWrap is { Item1: { } outerLeft })
{
sb.Append(outerLeft);
}
@ -67,7 +67,7 @@ public class NamePlateQuotedParts(NamePlateStringField field, bool isFreeCompany
sb.Append(isFreeCompany ? " «" : "《");
}
if (this.TextWrap is { Item1: var left, Item2: var right })
if (this.TextWrap is { Item1: { } left, Item2: { } right })
{
sb.Append(left);
sb.Append(this.Text ?? this.GetStrippedField(handler));
@ -87,7 +87,7 @@ public class NamePlateQuotedParts(NamePlateStringField field, bool isFreeCompany
sb.Append(isFreeCompany ? "»" : "》");
}
if (this.OuterWrap is { Item2: var outerRight })
if (this.OuterWrap is { Item2: { } outerRight })
{
sb.Append(outerRight);
}

View file

@ -35,7 +35,7 @@ public class NamePlateSimpleParts(NamePlateStringField field)
if ((nint)handler.GetFieldAsPointer(field) == NamePlateGui.EmptyStringPointer)
return;
if (this.TextWrap is { Item1: var left, Item2: var right })
if (this.TextWrap is { Item1: { } left, Item2: { } right })
{
var sb = new SeStringBuilder();
sb.Append(left);