From 4000bcbfea7a8c42fb35ba002e890ff504908a5a Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 23 Dec 2013 18:00:04 -0500 Subject: [PATCH] FIX: Only consider image sizes from valid src values. --- .../discourse/views/composer/composer_view.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/views/composer/composer_view.js b/app/assets/javascripts/discourse/views/composer/composer_view.js index c3faff72d74..8b7a942aa91 100644 --- a/app/assets/javascripts/discourse/views/composer/composer_view.js +++ b/app/assets/javascripts/discourse/views/composer/composer_view.js @@ -327,11 +327,12 @@ Discourse.ComposerView = Discourse.View.extend(Ember.Evented, { imageSizes: function() { var result = {}; $('#wmd-preview img').each(function(i, e) { - var $img = $(e); - result[$img.prop('src')] = { - width: $img.width(), - height: $img.height() - }; + var $img = $(e), + src = $img.prop('src'); + + if (src && src.length) { + result[src] = { width: $img.width(), height: $img.height() }; + } }); return result; },