From 5931dd4cb58b29d6797fbb28dbe35c89ec2d87e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sat, 7 Jan 2023 14:41:03 +0100 Subject: [PATCH] fix(packets): add forgotten nullable check to inline enum generator --- .../EnumInlineConverterGenerator.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Packets/NosSmooth.PacketSerializersGenerator/InlineConverterGenerators/EnumInlineConverterGenerator.cs b/Packets/NosSmooth.PacketSerializersGenerator/InlineConverterGenerators/EnumInlineConverterGenerator.cs index 05062b6..738816f 100644 --- a/Packets/NosSmooth.PacketSerializersGenerator/InlineConverterGenerators/EnumInlineConverterGenerator.cs +++ b/Packets/NosSmooth.PacketSerializersGenerator/InlineConverterGenerators/EnumInlineConverterGenerator.cs @@ -89,9 +89,12 @@ public static Result<{type}?> ParseEnum{type.ToString().Replace('.', '_')}(IStri }} var token = packetToken.Token; - if (token[0] == '-') + if (nullable) {{ - return Result<{type}?>.FromSuccess(null); + if (token[0] == '-') + {{ + return Result<{type}?>.FromSuccess(null); + }} }} if (!{underlyingType}.TryParse(token, out var val)) -- 2.49.0