From 6f4dbd6d4a27888ccff88d336ae4340cb69c90e7 Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 6 Apr 2018 12:08:51 -0700 Subject: [PATCH] metamask - never persist if state is missing data --- app/scripts/background.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index a4d95289b..837fd7133 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -162,9 +162,9 @@ function setupController (initState, initLangCode) { asStream(controller.store), debounce(1000), storeTransform(versionifyData), - storeTransform(syncDataWithExtension), + storeTransform(persistData), (error) => { - log.error('pump hit error', error) + log.error('MetaMask - Persistence pipeline failed', error) } ) @@ -173,7 +173,10 @@ function setupController (initState, initLangCode) { return versionedData } - function syncDataWithExtension(state) { + function persistData(state) { + if (!state.data) { + throw new Error('MetaMask - updated state is missing data', state) + } if (localStore.isSupported) { localStore.set(state) .catch((err) => {