From ee468e723ea32280a927afaa139aeca1b1a18674 Mon Sep 17 00:00:00 2001 From: Craig Drummond Date: Mon, 7 Mar 2022 20:15:21 +0000 Subject: [PATCH] Only try to remove files if there are some to remove --- src/db.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/db.rs b/src/db.rs index 17eb513..c9bea7b 100644 --- a/src/db.rs +++ b/src/db.rs @@ -167,10 +167,10 @@ impl Db { to_remove.push(db_path); } } - log::info!("Num non-existant tracks: {}", to_remove.len()); - if !dry_run { + let num_to_remove = to_remove.len(); + log::info!("Num non-existant tracks: {}", num_to_remove); + if !dry_run && num_to_remove>0 { let count_before = self.get_track_count(); - let num_to_remove = to_remove.len(); for t in to_remove { log::debug!("Remove '{}'", t); match self.conn.execute("DELETE FROM Tracks WHERE File = ?;", params![t]) {