diff options
| author | Max Audron <audron@cocaine.farm> | 2021-06-13 17:13:44 +0200 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2021-06-13 17:13:44 +0200 |
| commit | 5594ea549bb4f9eaaef69349e5c322d1a316b6b9 (patch) | |
| tree | cdab2877745c2f0659c3f7760049330ee38c7466 /macros | |
| parent | Release version 1.2.0 (diff) | |
fix crash on message only containing whitespace
Diffstat (limited to 'macros')
| -rw-r--r-- | macros/src/lib.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 0ec317e..2ccd220 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -198,7 +198,10 @@ pub fn catinator(tokens: TokenStream) -> TokenStream { match &command { Command::PRIVMSG(_target, text) => { - let mut word = text.split_ascii_whitespace().next().unwrap().chars(); + let mut word = match text.split_ascii_whitespace().next() { + Some(word) => word.chars(), + None => continue, + }; let prefix = word.next().unwrap(); let rest: String = word.collect(); |
