You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If document.ElementFromPoint returns null, then this if-statement is skipped and execution falls off the end of the function, without any return. This means the function returns undefined. Callers of this function only check for null, not undefined. Specifically this if-statement makes it so that in this case the controller assumes there is an element causing "Cannot read property X of undefined" errors further down the line.
The simplest fix is simply a return null; at the end of elementFromPoint.
I would suggest enabling TypeScript's strictNullChecks option, which can guard against problems like this.
The text was updated successfully, but these errors were encountered:
If
document.ElementFromPoint
returnsnull
, then this if-statement is skipped and execution falls off the end of the function, without any return. This means the function returnsundefined
. Callers of this function only check for null, not undefined. Specifically this if-statement makes it so that in this case the controller assumes there is an element causing "Cannot read property X of undefined" errors further down the line.The simplest fix is simply a
return null;
at the end ofelementFromPoint
.I would suggest enabling TypeScript's
strictNullChecks
option, which can guard against problems like this.The text was updated successfully, but these errors were encountered: