From f83c5819bf53334354fdd9e7aa2c0121bfeb5d24 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 25 Aug 2024 13:06:29 -0500 Subject: [PATCH] Fix exception editing cross-wiki redirects As described in T326169, when editing a (manually created) cross-wiki redirect, VisualEditor will throw a null dereference exception causing it to fail to load in the browser (looking like it is just taking forever to load). This patch prevents the exception from occurring by not attempting to write to the null object. Bug: T326169 Change-Id: I50fa803c7b4ce65dac1fe345431d8b8f9d0b3d61 (cherry picked from commit a9278f654b1c1f1286d59c10234b7a8a427eaf7b) --- modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js b/modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js index 1d1aa80f0d..4545d2b273 100644 --- a/modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js +++ b/modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js @@ -35,7 +35,9 @@ ve.dm.MWRedirectMetaItem.static.matchRdfaTypes = [ 'mw:PageProp/redirect' ]; ve.dm.MWRedirectMetaItem.static.toDataElement = function ( domElements, converter ) { // HACK piggy-back on MWInternalLinkAnnotation's ./ stripping logic var linkData = ve.dm.MWInternalLinkAnnotation.static.toDataElement( domElements, converter ); - linkData.type = this.name; + if ( linkData ) { + linkData.type = this.name; + } return linkData; };