Fix "null is not a string" error in event logging code

This getTitle() method can return null.

Bug: T299779
Change-Id: I33c6fc0cdd03ae45a04d4098cf101dc9fa3414e3
This commit is contained in:
Thiemo Kreuz 2022-07-21 13:24:24 +02:00
parent 3a0b3e07d5
commit cf77557a95

View file

@ -396,8 +396,10 @@ ve.ui.MWTemplateDialog.prototype.getActionProcess = function ( action ) {
}
var parts = dialog.transclusionModel.getParts();
for ( var i = 0; i < parts.length; i++ ) {
if ( parts[ i ].getTitle ) {
templateEvent.template_names.push( parts[ i ].getTitle() );
// Only {@see ve.dm.MWTemplateModel} have a title
var title = parts[ i ].getTitle && parts[ i ].getTitle();
if ( title ) {
templateEvent.template_names.push( title );
}
}
mw.track( 'event.VisualEditorTemplateDialogUse', templateEvent );