From 51207e7aa5f251346ab1dc945d7598c8f46d7b1b Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Wed, 23 Aug 2017 15:05:26 +0100 Subject: [PATCH] Allow for mw.body being null in extensions Bug: T173016 Change-Id: I8daa65e5dc0368b366710f044b621287e83e26f7 --- modules/ve-mw/ui/ve.ui.MWExtensionWindow.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js b/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js index 57ea1ae0cb..104ee9e76f 100644 --- a/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js +++ b/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js @@ -75,14 +75,16 @@ ve.ui.MWExtensionWindow.prototype.getInputPlaceholder = function () { ve.ui.MWExtensionWindow.prototype.getSetupProcess = function ( data, process ) { data = data || {}; return process.next( function () { - var dir; + var dir, mwData; // Initialization this.whitespace = [ '', '' ]; if ( this.selectedNode ) { - this.input.setValueAndWhitespace( this.selectedNode.getAttribute( 'mw' ).body.extsrc ); - this.originalMwData = this.selectedNode.getAttribute( 'mw' ); + mwData = this.selectedNode.getAttribute( 'mw' ); + // mwData.body can be null in extensions + this.input.setValueAndWhitespace( mwData.body && mwData.body.extsrc ); + this.originalMwData = mwData; } else { if ( !this.constructor.static.modelClasses[ 0 ].static.isContent ) { // New nodes should use linebreaks for blocks