From bef842ff4bb5223953e4f27d40fe035cc816c412 Mon Sep 17 00:00:00 2001 From: sentriz Date: Wed, 24 Jul 2019 11:10:05 +0100 Subject: [PATCH] close transation if there's one open im handlefolder --- scanner/scanner.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scanner/scanner.go b/scanner/scanner.go index 1477acc..e6dbc7d 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -244,6 +244,13 @@ func decoded(in string) string { // ## begin handlers func (s *Scanner) handleFolder(it *item) error { + if s.trTxOpen { + // a transaction still being open when we handle a folder can + // happen if there is a folder that contains /both/ tracks and + // sub folders + s.trTx.Commit() + s.trTxOpen = false + } folder := &model.Album{} defer func() { // folder's id will come from early return