Skip to content

Commit

Permalink
use optional chaining and default values so we're not calling toLower…
Browse files Browse the repository at this point in the history
…Case() on undefined values (#1902)
  • Loading branch information
rickycodes authored Oct 19, 2020
1 parent f3de4f1 commit c6d5090
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/components/UI/DrawerView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -930,8 +930,10 @@ class DrawerView extends PureComponent {
{section
.filter(item => {
if (!item) return undefined;
if (item.name.toLowerCase().indexOf('etherscan') !== -1) {
return this.hasBlockExplorer(network.provider.type);
const { name = undefined } = item;
if (name && name.toLowerCase().indexOf('etherscan') !== -1) {
const type = network.provider?.type;
return (type && this.hasBlockExplorer(type)) || undefined;
}
return true;
})
Expand Down

0 comments on commit c6d5090

Please sign in to comment.