fixing a TypeError when the function would be called without any arguments
authorKrinkle <krinkle@users.mediawiki.org>
Mon, 22 Nov 2010 23:40:07 +0000 (23:40 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Mon, 22 Nov 2010 23:40:07 +0000 (23:40 +0000)
resources/mediawiki.util/mediawiki.util.js

index 9e651cd..15c1735 100644 (file)
                 */
                'addPortletLink' : function( portlet, href, text, id, tooltip, accesskey, nextnode ) {
 
+                       // Check if there's atleast 3 arguments to prevent a TypeError
+                       if ( arguments.length < 3 ) {
+                               return null;
+                       }
                        // Setup the anchor tag
                        var $link = $('<a />').attr( 'href', href ).text( text );