From b622baada9d37c79ec7f9c2e0bdcaea0692db34b Mon Sep 17 00:00:00 2001 From: Adam Friedman Date: Fri, 14 Feb 2020 08:50:39 +1100 Subject: [PATCH] Correctly handle CommandOrCodeAction with missing "command" property OmniSharp/csharp-language-server-protocol#210 --- .../Serialization/Converters/CommandOrCodeActionConverter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Protocol/Serialization/Converters/CommandOrCodeActionConverter.cs b/src/Protocol/Serialization/Converters/CommandOrCodeActionConverter.cs index d0f304583..2e6e41eff 100644 --- a/src/Protocol/Serialization/Converters/CommandOrCodeActionConverter.cs +++ b/src/Protocol/Serialization/Converters/CommandOrCodeActionConverter.cs @@ -28,7 +28,8 @@ public override CommandOrCodeAction ReadJson(JsonReader reader, Type objectType, var result = JObject.Load(reader); // Commands have a name, CodeActions do not - if (result["command"].Type == JTokenType.String) + JToken command = result["command"]; + if (command?.Type == JTokenType.String) { return new CommandOrCodeAction(result.ToObject()); }