mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-26 19:56:49 +00:00
MWCategoryInputWidget: Don't explode on invalid titles
canonicalQueryValue can be null at this point, so let's not insert it into an array that contains strings. Bug: T76868 Change-Id: I8096a9c1017e883d28124bf807d2d375ae98452a
This commit is contained in:
parent
b0b53befdc
commit
d39dfaa837
|
@ -112,9 +112,10 @@ ve.ui.MWCategoryInputWidget.prototype.getLookupMenuItemsFromData = function ( da
|
|||
|
||||
prefixedCanonicalQueryValue = prefixedCanonicalQueryValue && prefixedCanonicalQueryValue.getPrefixedText();
|
||||
|
||||
// Invalid titles end up with canonicalQueryValue being null.
|
||||
if ( canonicalQueryValue ) {
|
||||
canonicalQueryValue = canonicalQueryValue.getMainText();
|
||||
} // Invalid titles just end up with canonicalQueryValue being null.
|
||||
}
|
||||
|
||||
$.each( data, function ( index, suggestedCategory ) {
|
||||
var suggestedCategoryTitle = mw.Title.newFromText(
|
||||
|
@ -151,7 +152,7 @@ ve.ui.MWCategoryInputWidget.prototype.getLookupMenuItemsFromData = function ( da
|
|||
} );
|
||||
|
||||
// New category
|
||||
if ( !exactMatch ) {
|
||||
if ( !exactMatch && canonicalQueryValue ) {
|
||||
newCategoryItems.push( canonicalQueryValue );
|
||||
linkCacheUpdate[prefixedCanonicalQueryValue] = { missing: true };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue