From f53397aec79739b54d848a46726b242fee759ec1 Mon Sep 17 00:00:00 2001 From: AtuyL Date: Fri, 23 Nov 2018 09:56:44 +0900 Subject: [PATCH] fix: avoid the screen white-out. Set to ignore the invalid stored json. --- app/actions/dat-middleware.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/actions/dat-middleware.js b/app/actions/dat-middleware.js index d953e10c..7669c14b 100644 --- a/app/actions/dat-middleware.js +++ b/app/actions/dat-middleware.js @@ -382,13 +382,13 @@ export default class DatMiddleware { } catch (_) { return } - const datOpts = JSON.parse(blob) + const datOpts = JSON.parse(blob || '{}') - blob = {} + blob = null try { blob = await readFile(joinPath(this.dataDir, 'paused.json'), 'utf8') } catch (_) {} - const paused = JSON.parse(blob) + const paused = JSON.parse(blob || '{}') for (const key of Object.keys(datOpts)) { const opts = JSON.parse(datOpts[key])