From 2170d80b157933fb4fa36bf0cc66f3780efdf0f1 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 6 Aug 2015 11:13:21 +0300 Subject: [PATCH] Guard against disconnect() being called twice (#15263) Change-Id: I9fa8b5659b4079684f3348c18a6e246914ee8447 --- .../server/communication/AtmospherePushConnection.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java index 357278f411..a45d9aa059 100644 --- a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java +++ b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java @@ -274,6 +274,13 @@ public class AtmospherePushConnection implements PushConnection { public void disconnect() { assert isConnected(); + if (resource == null) { + // Already disconnected. Should not happen but if it does, we don't + // want to cause NPEs + getLogger() + .fine("AtmospherePushConnection.disconnect() called twice, this should not happen"); + return; + } if (resource.isResumed()) { // This can happen for long polling because of // http://dev.vaadin.com/ticket/16919 -- 2.39.5