mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 17:31:52 -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;
|
Enumeration<NetworkInterface> enumeration;
|
||||||
try {
|
try {
|
||||||
enumeration = NetworkInterface.getNetworkInterfaces();
|
enumeration = NetworkInterface.getNetworkInterfaces();
|
||||||
while (!up && enumeration.hasMoreElements()) {
|
if (enumeration != null) {
|
||||||
NetworkInterface networkInterface = enumeration.nextElement();
|
while (!up && enumeration.hasMoreElements()) {
|
||||||
//noinspection Since15
|
NetworkInterface networkInterface = enumeration.nextElement();
|
||||||
up = networkInterface.isUp() && !networkInterface.isLoopback()
|
//noinspection Since15
|
||||||
&& networkInterface.getInetAddresses().hasMoreElements();
|
up = networkInterface.isUp() && !networkInterface.isLoopback()
|
||||||
|
&& networkInterface.getInetAddresses().hasMoreElements();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (NoSuchMethodError error) {
|
} catch (NoSuchMethodError error) {
|
||||||
ExchangeSession.LOGGER.debug("Unable to test network interfaces (not available under Java 1.5)");
|
ExchangeSession.LOGGER.debug("Unable to test network interfaces (not available under Java 1.5)");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user