Prevent exception throwing in getFilename of MWImageNode

This doesn't happen in real life (as resource is always set) but
it allows us to contruct these nodes from the factory with no data.

Change-Id: Iea146f5dc128ad9d0f36a79b6fe67d622767d46c
This commit is contained in:
Ed Sanders 2014-09-24 20:43:57 +01:00
parent 8517777b9f
commit 26751dc4a1

View file

@ -246,7 +246,7 @@ ve.dm.MWImageNode.prototype.onAttributeChange = function ( key, from, to ) {
*/ */
ve.dm.MWImageNode.prototype.getFilename = function () { ve.dm.MWImageNode.prototype.getFilename = function () {
// Strip ./ stuff and decode URI encoding // Strip ./ stuff and decode URI encoding
var resource = this.getAttribute( 'resource' ), var resource = this.getAttribute( 'resource' ) || '',
filename = resource.replace( /^(\.+\/)*/, '' ); filename = resource.replace( /^(\.+\/)*/, '' );
// Protect against decodeURIComponent() throwing exceptions // Protect against decodeURIComponent() throwing exceptions