From coverity: avoid null dereference when no network interface is available

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2217 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2014-01-28 21:54:34 +00:00
parent 8f6328237e
commit b0f53a82eb
1 changed files with 7 additions and 5 deletions

View File

@ -293,12 +293,14 @@ public final class ExchangeSessionFactory {
Enumeration<NetworkInterface> enumeration;
try {
enumeration = NetworkInterface.getNetworkInterfaces();
if (enumeration != null) {
while (!up && enumeration.hasMoreElements()) {
NetworkInterface networkInterface = enumeration.nextElement();
//noinspection Since15
up = networkInterface.isUp() && !networkInterface.isLoopback()
&& networkInterface.getInetAddresses().hasMoreElements();
}
}
} catch (NoSuchMethodError error) {
ExchangeSession.LOGGER.debug("Unable to test network interfaces (not available under Java 1.5)");
up = true;