Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add null check to prevent potential runtime errors #2319

Merged
merged 3 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/injected/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const isWalletAvailable = (
// For multiple injected providers, check providers array
// example coinbase inj wallet pushes over-ridden wallets
// into a providers array at window.ethereum
return !!provider.providers?.some(provider =>
return Array.isArray(provider.providers) && !!provider.providers?.some(provider =>
checkProviderIdentity({ provider, device })
)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/injected/src/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ const bitget: InjectedWalletModule = {
label: ProviderLabel.Bitget,
injectedNamespace: InjectedNameSpace.Bitget,
checkProviderIdentity: ({ provider }) =>
!!provider && !!provider['ethereum'][ProviderIdentityFlag.Bitget],
!!provider && !!provider['ethereum'] && !!provider['ethereum'][ProviderIdentityFlag.Bitget],
getIcon: async () => (await import('./icons/bitget.js')).default,
getInterface: async () => ({
provider: window.bitkeep && window.bitkeep.ethereum
Expand Down
Loading