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

Uncaught TypeError: Cannot read property 'right' of undefined #122

Open
srgroves opened this issue Jun 28, 2016 · 0 comments
Open

Uncaught TypeError: Cannot read property 'right' of undefined #122

srgroves opened this issue Jun 28, 2016 · 0 comments

Comments

@srgroves
Copy link

I noticed that in positionBeacons(), line 1399, it's accessing playerLocation.right without checking if playerLocation has been defined. It may not be, depending on what player.getClientRects returns. This causes the error in the title of this post. The last line below is 1399:

var playerLocation = player.getClientRects()[0];

// when we don't have an initial position, or the position hasn't changed 
if (lastPlayerLocation && playerLocation && (lastPlayerLocation.left === playerLocation.left && lastPlayerLocation.right === playerLocation.right && lastPlayerLocation.top === playerLocation.top && lastPlayerLocation.bottom === playerLocation.bottom)) {
    // no need to update positions
    return;
}

// save for next time
lastPlayerLocation = playerLocation;

var playerWidth = playerLocation.right - playerLocation.left;
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

1 participant