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
Lightbox.prototype.start resets this.album every time a new album is opened. It always ends by calling Lightbox.prototype.changeImage, which sets an Image.onload handler that accesses this.album[imageNumber] after the image is loaded (async). If the network is slow, it is possible for the user to close the album and open a new one before the image is loaded. If the new album opened by the user has less images in it than the index of the first image clicked, this.album[imageNumber] will be undefined, and the attempts to access its properties will result in an error. If the index is within the length of the new album it won't crash, it'll just show the "old" image in the new lightbox (which I guess is not expected/wrong behavior).
Lightbox.prototype.start resets this.album every time a new album is opened. It always ends by calling Lightbox.prototype.changeImage, which sets an Image.onload handler that accesses this.album[imageNumber] after the image is loaded (async). If the network is slow, it is possible for the user to close the album and open a new one before the image is loaded. If the new album opened by the user has less images in it than the index of the first image clicked, this.album[imageNumber] will be undefined, and the attempts to access its properties will result in an error. If the index is within the length of the new album it won't crash, it'll just show the "old" image in the new lightbox (which I guess is not expected/wrong behavior).
I've created an example on jsfiddle, https://jsfiddle.net/olwimo/h633q2re/
I've created a PR with a proposed fix, #628
The text was updated successfully, but these errors were encountered: