Florianschmidtwelzow has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/199663

Change subject: Fix undefined length on Special:Gather
......................................................................

Fix undefined length on Special:Gather

Don't try to use $.each() for null.

Change-Id: I1bb79f96f93034e4783f6504a3015a7951c8feac
---
M resources/ext.gather.special/init.js
1 file changed, 10 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather 
refs/changes/63/199663/1

diff --git a/resources/ext.gather.special/init.js 
b/resources/ext.gather.special/init.js
index 698b699..1e7e7e7 100644
--- a/resources/ext.gather.special/init.js
+++ b/resources/ext.gather.special/init.js
@@ -8,12 +8,16 @@
        function addOverlayManagerRoutes() {
                overlayManager.add( /^\/collection\/(.*)\/(.*)$/, function ( 
action, id ) {
                        id = parseInt( id, 10 );
-                       var collection;
-                       $.each( mw.config.get( 'wgGatherCollections' ), 
function () {
-                               if ( this.id === id && this.isWatchlist === 
false ) {
-                                       collection = this;
-                               }
-                       } );
+                       var collection,
+                               collections = mw.config.get( 
'wgGatherCollections' );
+
+                       if ( collections ) {
+                               $.each( mw.config.get( 'wgGatherCollections' ), 
function () {
+                                       if ( this.id === id && this.isWatchlist 
=== false ) {
+                                               collection = this;
+                                       }
+                               } );
+                       }
                        if ( collection ) {
                                if ( action === 'edit' ) {
                                        return new CollectionEditOverlay( {

-- 
To view, visit https://gerrit.wikimedia.org/r/199663
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1bb79f96f93034e4783f6504a3015a7951c8feac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to