-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Chore: Fix: Potential access to properties of undefined object. #55697
Chore: Fix: Potential access to properties of undefined object. #55697
Conversation
Warning: Type of PR label error To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. |
Size Change: +1 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
Flaky tests detected in 851836e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6692177612
|
Our code was assuming that the font family may be undefined in
a?.name || a?.slug
. But if a is really undefined we then do( a?.name || a?.slug ).localeCompare( b?.name || a?.slug )
which may cause accessing localeCompare of undefined which crashes the editor. If a may be undefined( a?.name || a?.slug )
may also be undefined so we need to change( a?.name || a?.slug )
to( a?.name || a?.slug )?
.