From cd2d380b1f75bf310c2a8c62e2ec4e3d6f4e39f8 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 26 Jun 2012 15:41:00 -0700 Subject: fix for the youtube giving an error when having less than 3 images Signed-off-by: Valerio Virgillito --- .../montage-google/youtube-channel.reel/youtube-channel.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'node_modules/montage-google/youtube-channel.reel/youtube-channel.js') diff --git a/node_modules/montage-google/youtube-channel.reel/youtube-channel.js b/node_modules/montage-google/youtube-channel.reel/youtube-channel.js index ca08564b..95cd336a 100644 --- a/node_modules/montage-google/youtube-channel.reel/youtube-channel.js +++ b/node_modules/montage-google/youtube-channel.reel/youtube-channel.js @@ -124,6 +124,8 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { draw: { value: function() { + var self = this; + if (this._script) { if(this.element.childNodes.length < 1) { this._savedReference.appendChild(this._script); @@ -135,9 +137,9 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { } if (this._entries) { - this.imageA.src = this._entries[0]["media$group"]["media$thumbnail"][0].url; - this.imageB.src = this._entries[1]["media$group"]["media$thumbnail"][0].url; - this.imageC.src = this._entries[2]["media$group"]["media$thumbnail"][0].url; + this.imageA.src = (this._entries[0]) ? this._entries[0]["media$group"]["media$thumbnail"][0].url : ""; + this.imageB.src = (this._entries[1]) ? this._entries[1]["media$group"]["media$thumbnail"][0].url : ""; + this.imageC.src = (this._entries[2]) ? this._entries[2]["media$group"]["media$thumbnail"][0].url : ""; } if (this._videoId) { @@ -145,8 +147,6 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { this._videoId = null; } - var self = this; - if (this._shouldShowPopup) { this._positionPopup(); -- cgit v1.2.3