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

fix: Handle null return value from getMethodData to prevent destructu… #27457

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

pedronfigueiredo
Copy link
Contributor

@pedronfigueiredo pedronfigueiredo commented Sep 27, 2024

…ring error

Description

The original code assumes that getMethodData will always return an object with a name property. However, in certain instances, getMethodData can return null. When this happens, destructuring the name property from null causes a runtime error.

To address this issue, the code has been updated to use optional chaining. This ensures that if getMethodData returns null, the destructuring will not occur, and contractMethodName will be set to undefined instead of causing an error.

Open in GitHub Codespaces

Related issues

Fixes: #27436

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@pedronfigueiredo pedronfigueiredo added the team-confirmations Push issues to confirmations team label Sep 27, 2024
@pedronfigueiredo pedronfigueiredo self-assigned this Sep 27, 2024
@pedronfigueiredo pedronfigueiredo requested a review from a team as a code owner September 27, 2024 15:44
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link

sonarcloud bot commented Sep 27, 2024

@Gudahtt Gudahtt merged commit d730f99 into develop Sep 27, 2024
85 of 86 checks passed
@Gudahtt Gudahtt deleted the pnf/27436 branch September 27, 2024 18:40
@github-actions github-actions bot locked and limited conversation to collaborators Sep 27, 2024
@metamaskbot metamaskbot added the release-12.6.0 Issue or pull request that will be included in release 12.6.0 label Sep 27, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [a315274]
Page Load Metrics (1853 ± 111 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint152326021854242116
domContentLoaded146424161819219105
load147425161853231111
domInteractive21190483617
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 14 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.6.0 Issue or pull request that will be included in release 12.6.0 team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot destructure property 'name' of '(intermediate value)' as it is null.
6 participants