From ec888ce038defa88c4abac6670f335ca92918f67 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 4 Apr 2024 04:58:46 +0000 Subject: [PATCH] don't show thesaurus infobox when there are no synonyms --- src/engines/answer/thesaurus.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engines/answer/thesaurus.rs b/src/engines/answer/thesaurus.rs index ad532aa..84bf885 100644 --- a/src/engines/answer/thesaurus.rs +++ b/src/engines/answer/thesaurus.rs @@ -50,6 +50,11 @@ pub struct ThesaurusItem { pub fn parse_response(body: &str) -> eyre::Result { let response = parse_thesaurus_com_response(body)?; + + if response.items.is_empty() { + return Ok(EngineResponse::new()); + } + let rendered_html = render_thesaurus_html(response); Ok(EngineResponse::answer_html(rendered_html))