summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura <the-ceo-of-antifa@protonmail.com>2023-01-16 18:30:05 +0100
committerLaura <the-ceo-of-antifa@protonmail.com>2023-01-16 18:30:05 +0100
commit028a7662ca1c8f51859fbf9f7c54f80c290eff58 (patch)
tree1f5dd42d989147b5861bc09a64cec4f7c27a195d
parent2fe747d2ca7287855adb608dbef38697549a7720 (diff)
downloadmiaowe-028a7662ca1c8f51859fbf9f7c54f80c290eff58.tar.gz
miaowe-028a7662ca1c8f51859fbf9f7c54f80c290eff58.zip
Don't crash on empty command
-rw-r--r--miaowe.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/miaowe.hs b/miaowe.hs
index a575bc2..3778e23 100644
--- a/miaowe.hs
+++ b/miaowe.hs
@@ -181,7 +181,9 @@ trySendFile channel path = (doesFileExist (path)
>> hFlush stdout))
processCommand :: IrcChannel -> MircString -> IO ()
-processCommand channel command | (words command)!!4 == "Quit" = exitSuccess
+processCommand channel command | length (words command) < 5 = sendToChannel channel
+ "You need to specify a command."
+ | (words command)!!4 == "Quit" = exitSuccess
| otherwise = (if isInfixOf "/" ((words command)!!4)
then
sendToChannel channel