From ac1d3ba594aa1cda2f69e04cca9bc4530786d038 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 13 Oct 2020 10:52:30 +0200 Subject: [PATCH] Added queue corrupted check when restoring it --- deemix/app/queuemanager.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/deemix/app/queuemanager.py b/deemix/app/queuemanager.py index 3b4ed32..7dbfa46 100644 --- a/deemix/app/queuemanager.py +++ b/deemix/app/queuemanager.py @@ -475,7 +475,15 @@ class QueueManager: if (configFolder / 'queue.json').is_file() and not len(self.queue): if interface: interface.send('restoringQueue') with open(configFolder / 'queue.json', 'r') as f: - qd = json.load(f) + try: + qd = json.load(f) + except json.decoder.JSONDecodeError: + logger.warn("Saved queue is corrupted, resetting it") + qd = { + 'queue': [], + 'queueComplete': [], + 'queueList': {} + } remove(configFolder / 'queue.json') self.restoreQueue(qd['queue'], qd['queueComplete'], qd['queueList'], settings) if interface: