From 028a7662ca1c8f51859fbf9f7c54f80c290eff58 Mon Sep 17 00:00:00 2001 From: Laura Date: Mon, 16 Jan 2023 18:30:05 +0100 Subject: Don't crash on empty command --- miaowe.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3