Condensed code with use of ??

This commit is contained in:
Chomp
2025-07-25 20:15:52 +01:00
parent 5cfb1421c7
commit ef50c3fea1
@@ -35,13 +35,8 @@ public class BaseInteractionRequestDataConverter : JsonConverter<BaseInteraction
var jsonText = jsonDocument.RootElement.GetRawText();
// Get the underlying 'type' of action the client is requesting we do
var action = jsonDocument.RootElement.GetProperty("Action").GetString();
// Handle nullability here in case action's GetString is null
if (action is null)
{
action = string.Empty;
}
var action = jsonDocument.RootElement.GetProperty("Action").GetString() ?? string.Empty;
return ConvertToCorrectType(action, jsonDocument.RootElement, jsonText, options);
}