Fix null reference error in 2017 source editor

Looking for other references can (as of now) never work in source
mode. There are never other references or reference lists.

Bug: T373661
Change-Id: Icaad4e71a1538c5fad6a0f016b342a7cb7b9db2f
This commit is contained in:
thiemowmde 2024-08-30 17:41:17 +02:00
parent 617ca08892
commit 581d987b88

View file

@ -195,7 +195,8 @@ ve.dm.MWGroupReferences.prototype.getInternalModelNode = function ( key ) {
* @return {ve.dm.MWReferenceNode[]} * @return {ve.dm.MWReferenceNode[]}
*/ */
ve.dm.MWGroupReferences.prototype.getRefUsages = function ( key ) { ve.dm.MWGroupReferences.prototype.getRefUsages = function ( key ) {
return ( this.nodeGroup.keyedNodes[ key ] || [] ) // T373661: This might never have been set in source mode
return ( this.nodeGroup && this.nodeGroup.keyedNodes[ key ] || [] )
.filter( ( node ) => !node.getAttribute( 'placeholder' ) && .filter( ( node ) => !node.getAttribute( 'placeholder' ) &&
!node.findParent( ve.dm.MWReferencesListNode ) !node.findParent( ve.dm.MWReferencesListNode )
); );