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/add check for null in gutenberg is block editor function #16201

Merged
merged 1 commit into from
Jun 25, 2019
Merged

Fix/add check for null in gutenberg is block editor function #16201

merged 1 commit into from
Jun 25, 2019

Conversation

myleshyson
Copy link
Contributor

@myleshyson myleshyson commented Jun 17, 2019

Description

This pull request addresses #16199. Adds a null check in the gutenberg_is_block_editor function so that we can avoid unexpected errors.

How has this been tested?

We are using the mailpoet plugin which utilizes wp_iframe (where this error is occuring). I added this check and the plugin works like it should now.

Types of changes

A very small quick fix to avoid a unexpected 500 error.

Fixes #16199.

@swissspidy
Copy link
Member

Seems reasonable to check whether the current screen is actually defined and not null. 👍

@ellatrix
Copy link
Member

https://developer.wordpress.org/reference/functions/get_current_screen/

Sounds good.

Not sure why there are e2e test errors? Perhaps a rebase resolves them?

@gziolo gziolo added [Type] Code Quality Issues or PRs that relate to code quality First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Bug An existing feature does not function as intended labels Jun 20, 2019
@aduth
Copy link
Member

aduth commented Jun 25, 2019

Previously: #15983, #15209 (cc @jorgefilipecosta)

It's a good additional hardening to consider, since get_current_screen is documented to possibly return null, we ought to anticipate it.

Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

Thanks for the fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Bug An existing feature does not function as intended [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to add a check for null for gutenberg_is_block_editor function
6 participants