Skip to content

Commit

Permalink
Fix a possible bug in BrowserNotifications
Browse files Browse the repository at this point in the history
  • Loading branch information
svk31 committed Aug 25, 2018
1 parent bd992e9 commit 1ee0ba3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/components/BrowserNotifications/BrowserNotifications.jsx
Expand Up @@ -99,11 +99,15 @@ class BrowserNotifications extends React.Component {
}
);

let realAmount = this._getRealAmountByAssetId(amount, assetId);
let symbol = this._getAssetSymbolByAssetId(assetId);
if (realAmount === null || symbol === null) return;

const body = counterpart.translate(
"browser_notification_messages.money_received_body",
{
amount: this._getRealAmountByAssetId(amount, assetId),
symbol: this._getAssetSymbolByAssetId(assetId)
amount: realAmount,
symbol
}
);

Expand Down Expand Up @@ -151,13 +155,13 @@ class BrowserNotifications extends React.Component {

_getRealAmountByAssetId(amount, assetId) {
const asset = ChainStore.getAsset(assetId);

if (!asset) return null;
return utils.get_asset_amount(amount, asset);
}

_getAssetSymbolByAssetId(assetId) {
const asset = ChainStore.getAsset(assetId);

if (!asset) return null;
return asset.get("symbol");
}

Expand Down

0 comments on commit 1ee0ba3

Please sign in to comment.