FIX: Only consider image sizes from valid src values.

This commit is contained in:
Robin Ward 2013-12-23 18:00:04 -05:00
parent 62f757da2c
commit 4000bcbfea

View File

@ -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;
},