From fa30bffa3b6513c8da1817f3d4a378f4236b38d2 Mon Sep 17 00:00:00 2001 From: jivanf Date: Sat, 27 Jan 2024 09:58:38 -0800 Subject: [PATCH 1/2] Return `null` when handling command result --- LethalAPI.Terminal/Models/CommandHandler.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LethalAPI.Terminal/Models/CommandHandler.cs b/LethalAPI.Terminal/Models/CommandHandler.cs index bd0f3f1..d7ad3b3 100644 --- a/LethalAPI.Terminal/Models/CommandHandler.cs +++ b/LethalAPI.Terminal/Models/CommandHandler.cs @@ -208,6 +208,11 @@ public static class CommandHandler /// command display response private static TerminalNode? HandleCommandResult(object? result, Terminal terminal) { + if (result is null) + { + return null; + } + if (result is TerminalNode node) { return node; From eb85c9651079f70d5f9fa7c60bd946d672400adc Mon Sep 17 00:00:00 2001 From: jivanf Date: Sat, 27 Jan 2024 10:06:34 -0800 Subject: [PATCH 2/2] Fix typo --- LethalAPI.Terminal/Models/CommandHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LethalAPI.Terminal/Models/CommandHandler.cs b/LethalAPI.Terminal/Models/CommandHandler.cs index d7ad3b3..7a5d6da 100644 --- a/LethalAPI.Terminal/Models/CommandHandler.cs +++ b/LethalAPI.Terminal/Models/CommandHandler.cs @@ -179,7 +179,7 @@ public static class CommandHandler continue; } - // A pass-though delegate to execute interactions, and return the response `TerminalNode` or null + // A pass-through delegate to execute interactions, and return the response `TerminalNode` or null var passThrough = () => HandleCommandResult(invoker(), terminal); candidateCommands.Add((registeredCommand, passThrough));