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
1 changed files with 6 additions and 5 deletions

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