From d9cebeb6a7d5cce181121190ac122df29fe6d5c6 Mon Sep 17 00:00:00 2001 From: Jokler Date: Tue, 24 Dec 2019 00:22:32 +0100 Subject: Quote: Filter out empty tokens on get --- src/plugins/quote/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/quote/mod.rs b/src/plugins/quote/mod.rs index 893b3e6..7223b42 100644 --- a/src/plugins/quote/mod.rs +++ b/src/plugins/quote/mod.rs @@ -96,12 +96,17 @@ impl Quote { } fn get(&self, command: &PluginCommand) -> Result { - let quotee = &command.tokens.get(0); + let tokens = command + .tokens + .iter() + .filter(|t| !t.is_empty()) + .collect::>(); + let quotee = &tokens.get(0); let channel = &command.target; match quotee { Some(quotee) => { - let idx = match command.tokens.get(1) { + let idx = match tokens.get(1) { Some(s) => Some(i32::from_str(s).context(ErrorKind::InvalidIndex)?), None => None, }; -- cgit v1.2.3-70-g09d2