From 2fb7b81cafddf47cd9dbd8a81dd1565d5b697f74 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Fri, 22 Nov 2024 14:46:11 +0000 Subject: [PATCH] ArticleTarget: Don't throw error on new heading node Change-Id: I4e0566de9ffa2112d99d9d574621ce57ce8b37f2 --- modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;