Thomas Vachuska

Fixing an NPE in GUI idle detect mechanism; ONOS-441

Change-Id: Id1edd74642915a266d9e935287b70cf5425c91f6
...@@ -168,14 +168,15 @@ public class TopologyViewWebSocket ...@@ -168,14 +168,15 @@ public class TopologyViewWebSocket
168 */ 168 */
169 synchronized boolean isIdle() { 169 synchronized boolean isIdle() {
170 boolean idle = (System.currentTimeMillis() - lastActive) > MAX_AGE_MS; 170 boolean idle = (System.currentTimeMillis() - lastActive) > MAX_AGE_MS;
171 - if (idle || !connection.isOpen()) { 171 + if (idle || (connection != null && !connection.isOpen())) {
172 return true; 172 return true;
173 - } 173 + } else if (connection != null) {
174 try { 174 try {
175 control.sendControl(PING, PING_DATA, 0, PING_DATA.length); 175 control.sendControl(PING, PING_DATA, 0, PING_DATA.length);
176 } catch (IOException e) { 176 } catch (IOException e) {
177 log.warn("Unable to send ping message due to: ", e); 177 log.warn("Unable to send ping message due to: ", e);
178 } 178 }
179 + }
179 return false; 180 return false;
180 } 181 }
181 182
......