diff --git a/Database/Keys.hs b/Database/Keys.hs index 0456ce7666..2183ecd245 100644 --- a/Database/Keys.hs +++ b/Database/Keys.hs @@ -151,7 +151,9 @@ openDb createdb _ = catchPermissionDenied permerr $ withExclusiveLock gitAnnexKe - data to it. -} closeDb :: Annex () -closeDb = liftIO . closeDbHandle =<< getDbHandle +closeDb = Annex.getState Annex.keysdbhandle >>= \case + Nothing -> return () + Just h -> liftIO (closeDbHandle h) addAssociatedFile :: Key -> TopFilePath -> Annex () addAssociatedFile k f = runWriterIO $ SQL.addAssociatedFile (toIKey k) f