From d9a296a34e9a2d76b03d5278bb334ed142078925 Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Sun, 22 Oct 2023 12:24:55 -0400 Subject: [PATCH] Fix potential panic resulting from no results chosen to print in print menu. --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/mytui/app.rs | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ee7499..27914d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -263,7 +263,7 @@ dependencies = [ [[package]] name = "cryptools" -version = "0.12.3" +version = "0.12.4" dependencies = [ "chrono", "crptls", diff --git a/Cargo.toml b/Cargo.toml index 6ec673f..ec98981 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cryptools" -version = "0.12.3" +version = "0.12.4" authors = ["scoobybejesus "] edition = "2021" description = "Command-line utility for processing cryptocurrency transactions into 'lots' and 'movements'." diff --git a/src/mytui/app.rs b/src/mytui/app.rs index 42650a1..6c3f5b9 100644 --- a/src/mytui/app.rs +++ b/src/mytui/app.rs @@ -137,6 +137,11 @@ pub fn export( println!("Attempting to export:"); + if app.to_print_by_idx.is_empty() { + println!(" None selected."); + return Ok(()) + } + for report_idx in app.to_print_by_idx.iter() { println!(" {}", reports[*report_idx]);