diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js index f384e3eb54..a321b2463d 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js @@ -308,9 +308,11 @@ ve.ui.MWCategoryWidget.prototype.removeItems = function ( names ) { for ( i = 0, len = names.length; i < len; i++ ) { categoryItem = this.categories[names[i]]; - categoryItem.disconnect( this ); - items.push( categoryItem ); - delete this.categories[names[i]]; + if ( categoryItem ) { + categoryItem.disconnect( this ); + items.push( categoryItem ); + delete this.categories[names[i]]; + } } OO.ui.GroupElement.prototype.removeItems.call( this, items );