From f0fbc94caedb2eeb02b47e0f55966d8fa1b5140a Mon Sep 17 00:00:00 2001 From: raeleus Date: Sat, 28 Sep 2024 13:45:08 -0700 Subject: [PATCH] Fixed crash when attack has no parameter. Resolves #11 --- Input.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Input.js b/Input.js index 8f374a7..ce4c3e7 100644 --- a/Input.js +++ b/Input.js @@ -1063,6 +1063,10 @@ function doAttack(command) { else difficultyText = difficultyText.toLowerCase() var targetText = getArgumentRemainder(command, textIndex) + if (targetText == null) { + state.show = "none" + return "\n[Error: Not enough parameters. See #help]\n" + } var toMatches = targetText.match(/^to\s+/gi) if (toMatches != null) targetText = targetText.substring(toMatches[0].length) targetText = stripPunctuation(targetText)