Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.js |
— | — | @@ -560,7 +560,7 @@ |
561 | 561 | var block = allowBlock ? '(?:\\/(?:3[0-2]|[12]?\\d))?' : ''; |
562 | 562 | var RE_IP_BYTE = '(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|0?[0-9]?[0-9])'; |
563 | 563 | var RE_IP_ADD = '(?:' + RE_IP_BYTE + '\\.){3}' + RE_IP_BYTE; |
564 | | - return address.search( new RegExp( '^' + RE_IP_ADD + block + '$' ) ) != -1; |
| 564 | + return typeof address === 'string' && address.search( new RegExp( '^' + RE_IP_ADD + block + '$' ) ) != -1; |
565 | 565 | }, |
566 | 566 | /** |
567 | 567 | * Note: borrows from IP::isIPv6 |
— | — | @@ -570,6 +570,9 @@ |
571 | 571 | * @return boolean |
572 | 572 | */ |
573 | 573 | 'isIPv6Address' : function( address, allowBlock ) { |
| 574 | + if ( typeof address !== 'string' ) { |
| 575 | + return false; |
| 576 | + } |
574 | 577 | var block = allowBlock ? '(?:\\/(?:12[0-8]|1[01][0-9]|[1-9]?\\d))?' : ''; |
575 | 578 | var RE_IPV6_ADD = |
576 | 579 | '(?:' + // starts with "::" (including "::") |