From e199d19dc1e425ac76021695129d5fbcd8107e88 Mon Sep 17 00:00:00 2001 From: EgoWumpus Date: Thu, 6 Jun 2013 13:03:31 -0600 Subject: [PATCH] Variable existence check Checks to make sure that oembedData.title even exists within the object; failure to exist results in 'undefined' to be inserted in the link. At least one third party (Flickr) fails to return this object with a title attribute. Example: http://www.flickr.com/photos/ahattar/8158065331/lightbox/ Goes to a login page, but an attempt to embed will return a 'success' result without a title object. --- jquery.oembed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.oembed.js b/jquery.oembed.js index dc2d91f..ed00a13 100644 --- a/jquery.oembed.js +++ b/jquery.oembed.js @@ -396,7 +396,7 @@ }; $.fn.oembed.getGenericCode = function(url, oembedData) { - var title = (oembedData.title !== null) ? oembedData.title : url, + var title = ((oembedData.title) && (oembedData.title !== null)) ? oembedData.title : url, code = '' + title + ''; if (oembedData.html) code += "
" + oembedData.html + "
"; return code;