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

Conversation

sigmoidr
Copy link
Contributor

@sigmoidr sigmoidr commented Dec 4, 2024

helpers.ts:

-    return !!provider.providers?.some(provider => checkProviderIdentity({ provider, device }));
+    return Array.isArray(provider.providers) && !!provider.providers.some(provider => checkProviderIdentity({ provider, device }));

wallets.ts:

-    checkProviderIdentity: ({ provider }) => !!provider && !!provider['ethereum'][ProviderIdentityFlag.Bitget],
+    checkProviderIdentity: ({ provider }) => !!provider && !!provider['ethereum'] && !!provider['ethereum'][ProviderIdentityFlag.Bitget]

Copy link
Member

@Adamj1232 Adamj1232 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This null check looks good and passes testing

@Adamj1232 Adamj1232 merged commit 9db4d8e into blocknative:develop Dec 27, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants