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

erroredFunction should also handle null? #29

Closed
fliespl opened this issue Feb 11, 2021 · 1 comment
Closed

erroredFunction should also handle null? #29

fliespl opened this issue Feb 11, 2021 · 1 comment

Comments

@fliespl
Copy link

fliespl commented Feb 11, 2021

When error as such appears in log: Uncaught TypeError: Cannot read property 'xxx' of undefined

JQMH also errors out, because erroredFunction is null and null is equal to object.

                if ( typeof erroredFunction !== 'object' || typeof erroredFunction[1] === "undefined" || -1 === jQueryFunctions.indexOf( erroredFunction[1] ) ) {
                    return true;
                }

Error caused:

Uncaught TypeError: Cannot read property '1' of null
    at window.onerror ((index):139)
window.onerror @ (index):139
error (async)
(anonymous) @ (index):115

Probably null should also be checked, when no matches are found?

@bndn
Copy link

bndn commented Apr 16, 2021

This error is reported on the WordPress support forum too. We have to add a condition to the line 289 of wp-content/plugins/enable-jquery-migrate-helper/class-jquery-migrate-helper.php to fix it:

if ( erroredFunction === null || typeof erroredFunction !== 'object' || typeof erroredFunction[1] === "undefined" || -1 === jQueryFunctions.indexOf( erroredFunction[1] ) ) {

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

No branches or pull requests

2 participants