Fix ip regex bug

This commit is contained in:
chteufleur 2015-09-03 17:59:10 +02:00
parent 7942a08c84
commit 5362627f35
1 changed files with 1 additions and 1 deletions

View File

@ -1,5 +1,5 @@
public static boolean isIp(String ip) {
return ip.matches("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$");
return ip != null && !ip.equals("") && ip.matches("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$");
}