From: minkee.lee Date: Thu, 18 Sep 2014 03:26:12 +0000 (+0900) Subject: Refactoring: Add null checking. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae87daff03f7b92e1b6b5f0def512030d6193764;p=sdk%2Femulator%2Femulator-manager.git Refactoring: Add null checking. Change-Id: I6878eaff9ebbf09afcf4b89aaa697b7dd745e642 Signed-off-by: minkee.lee --- diff --git a/common-project/src/org/tizen/emulator/manager/vms/helper/HelperClass.java b/common-project/src/org/tizen/emulator/manager/vms/helper/HelperClass.java index 51270b5..8940d0e 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/helper/HelperClass.java +++ b/common-project/src/org/tizen/emulator/manager/vms/helper/HelperClass.java @@ -221,17 +221,19 @@ public class HelperClass { Enumeration interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); - while (interfaces.hasMoreElements()){ - NetworkInterface current = interfaces.nextElement(); - - if (!current.isUp() || current.isLoopback() || current.isVirtual()) continue; - Enumeration addresses = current.getInetAddresses(); - while (addresses.hasMoreElements()){ - InetAddress current_addr = addresses.nextElement(); - if (current_addr.isLoopbackAddress()) continue; - if (current_addr instanceof Inet6Address) continue; - - loaclIPAddress = current_addr.getHostAddress(); + if (interfaces != null) { + while (interfaces.hasMoreElements()){ + NetworkInterface current = interfaces.nextElement(); + + if (!current.isUp() || current.isLoopback() || current.isVirtual()) continue; + Enumeration addresses = current.getInetAddresses(); + while (addresses.hasMoreElements()){ + InetAddress current_addr = addresses.nextElement(); + if (current_addr.isLoopbackAddress()) continue; + if (current_addr instanceof Inet6Address) continue; + + loaclIPAddress = current_addr.getHostAddress(); + } } } } catch (SocketException e) {