From f0f5fc9891d6967d6825016f4462575c5d787d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 29 Aug 2018 21:21:37 +0200 Subject: [PATCH] feat: Assert that query are not invalid ones --- raptor/src/levenshtein.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/raptor/src/levenshtein.rs b/raptor/src/levenshtein.rs index e3acea8a0..bf6ddbf03 100644 --- a/raptor/src/levenshtein.rs +++ b/raptor/src/levenshtein.rs @@ -16,6 +16,8 @@ impl LevBuilder { } pub fn get_automaton(&self, query: &str) -> Levenshtein { + assert!(!query.is_empty()); + let dfa = if query.len() <= 4 { self.automatons[0].build_prefix_dfa(query) } else if query.len() <= 8 {