From 4b570dce9af4307eac2fe8d26323066215464ccd Mon Sep 17 00:00:00 2001 From: Victor Häggqvist Date: Thu, 14 Jan 2016 22:57:23 +0100 Subject: fix undefined next preload --- src/LightBox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/LightBox.js b/src/LightBox.js index 5479819..e2094c1 100644 --- a/src/LightBox.js +++ b/src/LightBox.js @@ -216,10 +216,10 @@ export class LightBox { }, this.options.animationSpeed); if (this.options.preloadNext) { - let index = Array.prototype.indexOf.call(this.targets, this.target) + let index = Array.prototype.indexOf.call(this.targets, this.target); let next = this.targets[index + 1]; - if (next !== null) { + if (next !== null && next !== undefined) { log.debug('preloading next'); let nextImg = new Image(); nextImg.src = next.href; -- cgit v1.2.3