From 011162134b2d05df3c5377b9ba4f42c882ec0854 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 21 Jan 2026 13:55:47 +0400 Subject: [PATCH] fix: prevent max_results=0 in search command --- src/cli/commands.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cli/commands.rs b/src/cli/commands.rs index f128499..e655462 100644 --- a/src/cli/commands.rs +++ b/src/cli/commands.rs @@ -259,6 +259,11 @@ impl Cli { if self.command.is_none() && !self.query.is_empty() { let query = self.query.join(" "); let max_results = self.max_results.unwrap_or(config.max_results); + + if max_results == 0 { + anyhow::bail!("max_results must be greater than 0"); + } + let show_content = self.content || config.show_content; return run_search_smart( &config, @@ -293,6 +298,11 @@ impl Cli { let max_results = max_results .or(self.max_results) .unwrap_or(config.max_results); + + if max_results == 0 { + anyhow::bail!("max_results must be greater than 0"); + } + let content = content || self.content || config.show_content; run_search_smart( &config,