diff --git a/deemix/plugins/spotify.js b/deemix/plugins/spotify.js index fc63d8e..d09584a 100644 --- a/deemix/plugins/spotify.js +++ b/deemix/plugins/spotify.js @@ -401,7 +401,13 @@ class Spotify extends Plugin { let cache try { cache = JSON.parse(fs.readFileSync(this.configFolder+'cache.json')) - } catch { + } catch (e){ + if (e.name === "SyntaxError"){ + fs.writeFileSync(this.configFolder+'cache.json', JSON.stringify( + {tracks: {}, albums: {}}, + null, 2 + )) + } cache = {tracks: {}, albums: {}} } return cache