diff options
Diffstat (limited to 'qml_plugin/src')
| -rw-r--r-- | qml_plugin/src/web/duckduckgo.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/qml_plugin/src/web/duckduckgo.rs b/qml_plugin/src/web/duckduckgo.rs index 6de39af..b87d5af 100644 --- a/qml_plugin/src/web/duckduckgo.rs +++ b/qml_plugin/src/web/duckduckgo.rs @@ -145,7 +145,15 @@ pub async fn query(input: &str) -> anyhow::Result<DuckDuckGoContent> { // TODO: try also Results[*].Icon.URL and RelatedTopics[*].Icon.URL image: resp .image - .and_then(|i| Url::parse(&format!("{DUCKDUCKGO}{i}",)).ok()), + .and_then( + |i| { + if !i.is_empty() { + Url::parse(&format!("{DUCKDUCKGO}{i}",)).ok() + } else { + None + } + }, + ), }, ) } |
