From 92f302875f20db8193592a8344b354cb3081d13a Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 24 Feb 2020 02:57:48 -0500 Subject: [PATCH] Added parameter check to Process method in CommandEngine.cs. --- RecrownedGTK.Tools/CommandProcessor/CommandEngine.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RecrownedGTK.Tools/CommandProcessor/CommandEngine.cs b/RecrownedGTK.Tools/CommandProcessor/CommandEngine.cs index d7e65b6..75a92ca 100644 --- a/RecrownedGTK.Tools/CommandProcessor/CommandEngine.cs +++ b/RecrownedGTK.Tools/CommandProcessor/CommandEngine.cs @@ -34,6 +34,9 @@ namespace RecrownedGTK.Tools.CommandProcessor public void Process(IUserInput userInput, IUserOutput userOutput, string commandAndArguments) { + if (userInput == null || userOutput == null || commandAndArguments == null) { + throw new ArgumentNullException("No arguments should be null."); + } string command = commandAndArguments; string[] arguments = null; @@ -75,6 +78,11 @@ namespace RecrownedGTK.Tools.CommandProcessor GetCommand(command).Run(userInput, userOutput, arguments); } + /// + /// Check if the command exists using it's invokes string. + /// + /// A string that will invoke the command. + /// public bool ContainsCommand(string command) { for (int i = 0; i < commands.Count; i++)