mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-23 01:19:02 +00:00
Fix EquivalentValue crash on invalid tokens (#511)
This commit is contained in:
parent
4b3def2fce
commit
6cb0ebff5b
@ -36,10 +36,12 @@ export const fetchRates = (symbols: string[] = []): Promise<CCResponse> =>
|
|||||||
// to their respective rates via ETH.
|
// to their respective rates via ETH.
|
||||||
return symbols.reduce(
|
return symbols.reduce(
|
||||||
(eqRates, sym) => {
|
(eqRates, sym) => {
|
||||||
|
if (rates[sym]) {
|
||||||
eqRates[sym] = rateSymbols.reduce((symRates, rateSym) => {
|
eqRates[sym] = rateSymbols.reduce((symRates, rateSym) => {
|
||||||
symRates[rateSym] = 1 / rates[sym] * rates[rateSym];
|
symRates[rateSym] = 1 / rates[sym] * rates[rateSym];
|
||||||
return symRates;
|
return symRates;
|
||||||
}, {});
|
}, {});
|
||||||
|
}
|
||||||
return eqRates;
|
return eqRates;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@ export default class EquivalentValues extends React.Component<Props, CmpState> {
|
|||||||
<option value="ETH">ETH</option>
|
<option value="ETH">ETH</option>
|
||||||
{tokenBalances &&
|
{tokenBalances &&
|
||||||
tokenBalances.map(tk => {
|
tokenBalances.map(tk => {
|
||||||
if (!tk.balance || tk.balance.isZero()) {
|
if (!tk.balance || tk.balance.isZero() || !rates[tk.symbol]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const sym = tk.symbol;
|
const sym = tk.symbol;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user