From ea7257b6145e8ff744a6e0ecb0716e046c736d6f Mon Sep 17 00:00:00 2001 From: Reach Date: Sun, 29 Dec 2024 19:40:53 +0100 Subject: [PATCH 1/2] fix(wrapped): fix crash when history is empty --- crates/atuin/src/command/client/wrapped.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/atuin/src/command/client/wrapped.rs b/crates/atuin/src/command/client/wrapped.rs index 7c5ca0585e8..99614af906a 100644 --- a/crates/atuin/src/command/client/wrapped.rs +++ b/crates/atuin/src/command/client/wrapped.rs @@ -280,6 +280,10 @@ pub async fn run( ); let history = db.range(start, end).await?; + if history.is_empty() { + println!("Your history for {year} is empty!\nMaybe 'atuin import' could help you import your previous history 🪄"); + return Ok(()) + } // Compute overall stats using existing functionality let stats = compute(settings, &history, 10, 1).expect("Failed to compute stats"); From 9b29f24fbdef515208ea3867c548bb99b1b7cfeb Mon Sep 17 00:00:00 2001 From: Reach Date: Sun, 29 Dec 2024 20:28:54 +0100 Subject: [PATCH 2/2] style: fix format --- crates/atuin/src/command/client/wrapped.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/atuin/src/command/client/wrapped.rs b/crates/atuin/src/command/client/wrapped.rs index 99614af906a..4dbc1cf025f 100644 --- a/crates/atuin/src/command/client/wrapped.rs +++ b/crates/atuin/src/command/client/wrapped.rs @@ -282,7 +282,7 @@ pub async fn run( let history = db.range(start, end).await?; if history.is_empty() { println!("Your history for {year} is empty!\nMaybe 'atuin import' could help you import your previous history 🪄"); - return Ok(()) + return Ok(()); } // Compute overall stats using existing functionality