Add extra safe-guard to ve.ui.MWCitationDialogTool

Note this doesn't fully solve T374068. The issue is probably that the
reuse tab shouldn't be visible in the first place. Still I think this
is a useful safe-guard that cannot hurt. We are doing the same in
almost all other places already.

Bug: T374068
Change-Id: I9b91374dbda74af75d8c36e24ffe5b9448da1aa7
This commit is contained in:
thiemowmde 2024-09-05 17:54:50 +02:00
parent 2890772a9f
commit 878a29b727

View file

@ -49,7 +49,7 @@ ve.ui.MWCitationDialogTool.static.isCompatibleWith = function ( model ) {
// Check if content of the reference node contains only a template with the same name as
// this.template
const internalItem = model.getInternalItem();
const branches = internalItem.getChildren();
const branches = internalItem ? internalItem.getChildren() : [];
if ( branches.length === 1 && branches[ 0 ].canContainContent() ) {
const leaves = branches[ 0 ].getChildren();
if ( leaves.length === 1 && leaves[ 0 ] instanceof ve.dm.MWTransclusionNode ) {