diff --git a/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js index 43c9044a5c..e7e92cb4ed 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js @@ -2114,7 +2114,7 @@ ve.init.mw.ArticleTarget.prototype.restoreEditSection = function () { dmDoc.getNodesByType( 'mwHeading' ).some( ( heading ) => { const domElements = heading.getOriginalDomElements( dmDoc.getStore() ); if ( - domElements && domElements[ 0 ].nodeType === Node.ELEMENT_NODE && + domElements && domElements.length && domElements[ 0 ].nodeType === Node.ELEMENT_NODE && domElements[ 0 ].getAttribute( 'data-mw-section-id' ) === section ) { headingModel = heading;