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

Avoid failures on asynchronous image update when lightbox has closed #3646

Merged
merged 1 commit into from
Jun 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions extensions/amp-image-lightbox/0.1/amp-image-lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ export class ImageViewer {
* @private
*/
updateSrc_() {
if (!this.srcset_) {
// Do not update source if the lightbox has already exited.
return Promise.resolve();
}
this.maxSeenScale_ = Math.max(this.maxSeenScale_, this.scale_);
const width = this.imageBox_.width * this.maxSeenScale_;
const src = this.srcset_.select(width, this.lightbox_.getDpr()).url;
Expand Down