mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
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:
parent
8f6328237e
commit
b0f53a82eb
@ -293,11 +293,13 @@ public final class ExchangeSessionFactory {
|
||||
Enumeration<NetworkInterface> enumeration;
|
||||
try {
|
||||
enumeration = NetworkInterface.getNetworkInterfaces();
|
||||
while (!up && enumeration.hasMoreElements()) {
|
||||
NetworkInterface networkInterface = enumeration.nextElement();
|
||||
//noinspection Since15
|
||||
up = networkInterface.isUp() && !networkInterface.isLoopback()
|
||||
&& networkInterface.getInetAddresses().hasMoreElements();
|
||||
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)");
|
||||
|
Loading…
x
Reference in New Issue
Block a user