From e64e6f7f47633b1aa683e6e559f67bce5f3e0027 Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Thu, 29 Dec 2022 15:32:25 +0300 Subject: [PATCH] feat(lib): weeding also removes sasa with invalid file path --- lib/database.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/database.c b/lib/database.c index 0de53fe..52690be 100644 --- a/lib/database.c +++ b/lib/database.c @@ -58,9 +58,10 @@ int tanabata_weed(Tanabata *tanabata) { } if (tanabata->sasahyou.hole_cnt > 0) { hole_cnt = 0; + struct stat st; Sasa *current_sasa = tanabata->sasahyou.database; for (uint64_t i = 0; i < tanabata->sasahyou.size; i++) { - if (current_sasa->id != HOLE_ID) { + if (current_sasa->id != HOLE_ID && stat(current_sasa->path, &st) == 0) { if (hole_cnt > 0) { new_id = current_sasa->id - hole_cnt; kazari_rem_by_sasa(&tanabata->shoppyou, current_sasa->id);