Index: trunk/phase3/resources/mediawiki/mediawiki.util.js |
— | — | @@ -555,10 +555,13 @@ |
556 | 556 | * @return boolean |
557 | 557 | */ |
558 | 558 | 'isIPv4Address' : function( address, allowBlock ) { |
| 559 | + if ( typeof address !== 'string' ) { |
| 560 | + return false; |
| 561 | + } |
559 | 562 | var block = allowBlock ? '(?:\\/(?:3[0-2]|[12]?\\d))?' : ''; |
560 | 563 | var RE_IP_BYTE = '(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|0?[0-9]?[0-9])'; |
561 | 564 | var RE_IP_ADD = '(?:' + RE_IP_BYTE + '\\.){3}' + RE_IP_BYTE; |
562 | | - return typeof address === 'string' && address.search( new RegExp( '^' + RE_IP_ADD + block + '$' ) ) != -1; |
| 565 | + return address.search( new RegExp( '^' + RE_IP_ADD + block + '$' ) ) != -1; |
563 | 566 | }, |
564 | 567 | /** |
565 | 568 | * Note: borrows from IP::isIPv6 |