From e4c20df4a896209636078c7acf33fbcaa8ad35bc Mon Sep 17 00:00:00 2001 From: Archi Date: Tue, 27 Feb 2024 01:44:21 +0100 Subject: [PATCH] Misc --- ArchiSteamFarm/Helpers/Json/GuidJsonConverter.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ArchiSteamFarm/Helpers/Json/GuidJsonConverter.cs b/ArchiSteamFarm/Helpers/Json/GuidJsonConverter.cs index 46bab4cb7eb45..3d26e4fe1e044 100644 --- a/ArchiSteamFarm/Helpers/Json/GuidJsonConverter.cs +++ b/ArchiSteamFarm/Helpers/Json/GuidJsonConverter.cs @@ -34,7 +34,13 @@ internal sealed class GuidJsonConverter : JsonConverter { 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