From 522c16726f2a417ff403af9a4978d7363f7da094 Mon Sep 17 00:00:00 2001 From: "Alexandre GV." Date: Tue, 7 Jan 2025 21:16:48 +0100 Subject: fix(wrapped): fix crash when history is empty (#2508) * fix(wrapped): fix crash when history is empty * style: fix format --- 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 7c5ca058..4dbc1cf0 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"); -- cgit v1.3.1