From 89e0c1838a5492d55c7355f60ed822586662a3f2 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Wed, 4 Mar 2020 02:04:42 -0600
Subject: [PATCH] Allow library to load empty

---
 badwitch.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/badwitch.py b/badwitch.py
index cccdb06..9e42f35 100755
--- a/badwitch.py
+++ b/badwitch.py
@@ -25,9 +25,13 @@ class Library:
 
     # Load from file
     def load(self):
-        with open(self.file, 'r+') as libfd:
-            libfd.seek(0)
-            self.albums = json.load(libfd)
+        try:
+            with open(self.file, 'r+') as libfd:
+                libfd.seek(0)
+                self.albums = json.load(libfd)
+        except FileNotFoundError:
+            logging.debug('Could not find library, loading empty')
+            self.albums = {}
         return
 
     # Save to file