From b8f96bb5124b0db49724c69dc6c35f721034806f Mon Sep 17 00:00:00 2001 From: Moriel Schottlender Date: Fri, 24 Oct 2014 16:18:06 -0400 Subject: [PATCH] Make sure initialHash exists before checking its value (Followup on If17b50cc4a39993) Make sure initialHash is set before checking and changing its value in the MWImageModel method. If a user chooses a brand new image to insert into the document (an insertion rather than update) then the initial hash is empty, and changing its values will fail with an error message. Bug: 72492 Change-Id: I3f9ea74891cc0ab77a07fa5d4e9cbc591f5b93e6 --- modules/ve-mw/dm/models/ve.dm.MWImageModel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js index fe70d3e87f..b0cd7b243e 100644 --- a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js +++ b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js @@ -1066,7 +1066,7 @@ ve.dm.MWImageModel.prototype.attachScalable = function ( scalable ) { // We have to adjust the details in the initial hash if the original // image was 'default' since we didn't have default until now and the // default dimensions that were 'recorded' were wrong - if ( this.initialHash.scalable.isDefault ) { + if ( !$.isEmptyObject( this.initialHash ) && this.initialHash.scalable.isDefault ) { this.initialHash.scalable.currentDimensions = this.scalable.getDefaultDimensions(); }