Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Feb 27, 2024
1 parent 5135677 commit e4c20df
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ArchiSteamFarm/Helpers/Json/GuidJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ internal sealed class GuidJsonConverter : JsonConverter<Guid> {
internal static readonly GuidJsonConverter Shared = new();

public override Guid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
if (reader.TryGetGuid(out Guid result)) {
// Great, we can work with it
return result;
}

try {
// Try again using more flexible implementation, sigh
return Guid.Parse(reader.GetString()!);
} catch {
// Throw JsonException instead, which will be converted into standard message by STJ
Expand Down

0 comments on commit e4c20df

Please sign in to comment.