From 68b1923cb6548adc516249b15d0171741c8ee8bf Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Mon, 10 Aug 2020 11:45:50 +0000 Subject: [PATCH] Clear title ID at the end of scans This minimizes the chance of getting an unexpected empty home page --- src/library/library.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/library/library.cr b/src/library/library.cr index 3813f14..f145342 100644 --- a/src/library/library.cr +++ b/src/library/library.cr @@ -92,7 +92,6 @@ class Library "Attempting to create it" Dir.mkdir_p @dir end - @title_ids.clear storage = Storage.new auto_close: false @@ -103,6 +102,7 @@ class Library .map { |path| Title.new path, "", storage, self } .select { |title| !(title.entries.empty? && title.titles.empty?) } .sort { |a, b| a.title <=> b.title } + .tap { |_| @title_ids.clear } .each do |title| @title_hash[title.id] = title @title_ids << title.id