aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEsteban MIno <efmino@uc.cl>2018-08-01 01:07:28 +0800
committerEsteban MIno <efmino@uc.cl>2018-08-01 01:07:28 +0800
commitccae79d392b76d6277bbbb7c887f520e66f81a2f (patch)
tree81647694e37d5050b3acfd435e8081fcc5025d30
parent22cf5a1391be5babae1a05bfb7b3dcde7110e286 (diff)
downloadtangerine-wallet-browser-ccae79d392b76d6277bbbb7c887f520e66f81a2f.tar.gz
tangerine-wallet-browser-ccae79d392b76d6277bbbb7c887f520e66f81a2f.tar.zst
tangerine-wallet-browser-ccae79d392b76d6277bbbb7c887f520e66f81a2f.zip
fix undefined for tokens on tests
-rw-r--r--app/scripts/controllers/preferences.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js
index 193965c2c..0cc61ba61 100644
--- a/app/scripts/controllers/preferences.js
+++ b/app/scripts/controllers/preferences.js
@@ -405,13 +405,15 @@ class PreferencesController {
/**
* Updates `accountTokens` and `tokens` of current account and network according to it.
*
- * @param {[array]} tokens Array of tokens to be updated.
+ * @param {array} tokens Array of tokens to be updated.
*
*/
_updateAccountTokens (tokens) {
const accountTokens = this.store.getState().accountTokens
const selectedAddress = this.store.getState().selectedAddress
const providerType = this.network.providerStore.getState().type
+ if (!(selectedAddress in accountTokens)) accountTokens[selectedAddress] = {}
+ if (!(providerType in accountTokens[selectedAddress])) accountTokens[selectedAddress][providerType] = []
accountTokens[selectedAddress][providerType] = tokens
this.store.updateState({ accountTokens, tokens })
}