Merge pull request #3741 from MetaMask/i3692-addtoken-address-undefined

Prevent users from adding custom token if decimals is an empty string.
This commit is contained in:
kumavis 2018-03-27 19:07:23 -07:00 committed by GitHub
commit c84f0ac7bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -142,7 +142,10 @@ AddTokenScreen.prototype.validate = function () {
errors.customAddress = this.props.t('invalidAddress')
}
const validDecimals = customDecimals !== null && customDecimals >= 0 && customDecimals < 36
const validDecimals = customDecimals !== null
&& customDecimals !== ''
&& customDecimals >= 0
&& customDecimals < 36
if (!validDecimals) {
errors.customDecimals = this.props.t('decimalsMustZerotoTen')
}