Skip to content

Commit

Permalink
Simple fix for crash on event registration (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
jurevans authored Jul 10, 2023
1 parent d512917 commit e99ea46
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ export const ExtensionEventsProvider: React.FC = (props): JSX.Element => {
metamaskAccountChangedHandler,
false,
(event, handler) => {
window.ethereum.on(event, handler);
if (window.ethereum) {
window.ethereum.on(event, handler);
}
},
(event, handler) => {
window.ethereum.removeListener(event, handler);
if (window.ethereum) {
window.ethereum.removeListener(event, handler);
}
}
);

Expand Down

0 comments on commit e99ea46

Please sign in to comment.