Skip to content

Commit

Permalink
Fix: Ignore empty data when storing
Browse files Browse the repository at this point in the history
  • Loading branch information
Zai-Kun committed Nov 29, 2024
1 parent 1d03f0f commit a8e8548
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ fn list_items(data_manager: &DataManager) -> Result<(), Box<dyn Error>> {
/// Store a new item from standard input.
fn store_item(data_manager: &mut DataManager) -> Result<(), Box<dyn Error>> {
let input_data = read_stdin_as_bytes()?;
if input_data.is_empty() {
return Ok(());
}
data_manager.add_item(&input_data)?;
Ok(())
}
Expand Down

0 comments on commit a8e8548

Please # to comment.