diff options
author | Frankie <frankie.diamond@gmail.com> | 2019-02-01 02:09:28 +0800 |
---|---|---|
committer | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2019-02-01 02:09:28 +0800 |
commit | 4e27b644ab962cd45ebadf33f3671eebbad93b01 (patch) | |
tree | 925594c7c229e917703891c3bf0d295fd04b7eb5 /app | |
parent | 7c0e0b6065f0d7308a4a12fca656c85437b75aa0 (diff) | |
download | tangerine-wallet-browser-4e27b644ab962cd45ebadf33f3671eebbad93b01.tar tangerine-wallet-browser-4e27b644ab962cd45ebadf33f3671eebbad93b01.tar.gz tangerine-wallet-browser-4e27b644ab962cd45ebadf33f3671eebbad93b01.tar.bz2 tangerine-wallet-browser-4e27b644ab962cd45ebadf33f3671eebbad93b01.tar.lz tangerine-wallet-browser-4e27b644ab962cd45ebadf33f3671eebbad93b01.tar.xz tangerine-wallet-browser-4e27b644ab962cd45ebadf33f3671eebbad93b01.tar.zst tangerine-wallet-browser-4e27b644ab962cd45ebadf33f3671eebbad93b01.zip |
fix - migration 30 undefinds (#6079)
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/migrations/030.js | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/app/scripts/migrations/030.js b/app/scripts/migrations/030.js index 19b686c58..10f7d33b2 100644 --- a/app/scripts/migrations/030.js +++ b/app/scripts/migrations/030.js @@ -24,23 +24,25 @@ module.exports = { function transformState (state) { const newState = state - - const frequentRpcListDetail = newState.PreferencesController.frequentRpcListDetail - if (frequentRpcListDetail) { - frequentRpcListDetail.forEach((rpc, index) => { - if (!!rpc.chainId && Number.isNaN(parseInt(rpc.chainId))) { - delete frequentRpcListDetail[index].chainId - } - }) - newState.PreferencesController.frequentRpcListDetail = frequentRpcListDetail - } - - if (newState.NetworkController.network && Number.isNaN(parseInt(newState.NetworkController.network))) { - delete newState.NetworkController.network + if (state.PreferencesController) { + const frequentRpcListDetail = newState.PreferencesController.frequentRpcListDetail + if (frequentRpcListDetail) { + frequentRpcListDetail.forEach((rpc, index) => { + if (!!rpc.chainId && Number.isNaN(parseInt(rpc.chainId))) { + delete frequentRpcListDetail[index].chainId + } + }) + newState.PreferencesController.frequentRpcListDetail = frequentRpcListDetail + } } - - if (newState.NetworkController.provider && newState.NetworkController.provider.chainId && Number.isNaN(parseInt(newState.NetworkController.provider.chainId))) { - delete newState.NetworkController.provider.chainId + if (state.NetworkController) { + if (newState.NetworkController.network && Number.isNaN(parseInt(newState.NetworkController.network))) { + delete newState.NetworkController.network + } + + if (newState.NetworkController.provider && newState.NetworkController.provider.chainId && Number.isNaN(parseInt(newState.NetworkController.provider.chainId))) { + delete newState.NetworkController.provider.chainId + } } return newState |