Only write InvalidOrUnloadableProfile if it's not null
This commit is contained in:
@@ -104,8 +104,9 @@ public record Info
|
||||
[JsonPropertyName("edition")]
|
||||
public string? Edition { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public bool InvalidOrUnloadableProfile { get; internal set; } = false;
|
||||
[JsonPropertyName("invalidOrUnloadableProfile")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public bool? InvalidOrUnloadableProfile { get; internal set; }
|
||||
}
|
||||
|
||||
public record Characters
|
||||
|
||||
@@ -215,7 +215,10 @@ public class SaveServer(
|
||||
}
|
||||
|
||||
// We don't proceed further here as only one object in the profile has data in it.
|
||||
if (profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile)
|
||||
if (
|
||||
profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile is not null
|
||||
&& profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile!.Value
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -236,7 +239,10 @@ public class SaveServer(
|
||||
public async Task<long> SaveProfileAsync(MongoId sessionID)
|
||||
{
|
||||
// No need to save profiles that have been marked as invalid
|
||||
if (profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile)
|
||||
if (
|
||||
profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile is not null
|
||||
&& profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile!.Value
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user