diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-21 03:31:43 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-21 03:31:43 +0200 |
commit | 0b1f9383ceef948a22ae163c0524ab9fa212183b (patch) | |
tree | bbce864ab6a6bc564e64c34f7602312fcc2dd78f /src/jrummikub/control/network | |
parent | fc3c5a3e28e79dc75f93e1730145457974992ddd (diff) | |
download | JRummikub-0b1f9383ceef948a22ae163c0524ab9fa212183b.tar JRummikub-0b1f9383ceef948a22ae163c0524ab9fa212183b.zip |
Fix NullPointerException on disconnect
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@534 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/control/network')
-rw-r--r-- | src/jrummikub/control/network/ConnectionControl.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/jrummikub/control/network/ConnectionControl.java b/src/jrummikub/control/network/ConnectionControl.java index 2d8ff60..897d0f5 100644 --- a/src/jrummikub/control/network/ConnectionControl.java +++ b/src/jrummikub/control/network/ConnectionControl.java @@ -68,6 +68,12 @@ public class ConnectionControl implements IConnectionControl { private final static String ELEMENT_NAME = "rummikub"; private final static String NAMESPACE = "http://home.universe-factory.net/rummikub/"; + private final static Runnable STOP_ACTION = new Runnable() { + @Override + public void run() { + } + }; + private final LoginData loginData; private volatile Connection connection; private volatile MultiUserChat muc; @@ -120,18 +126,14 @@ public class ConnectionControl implements IConnectionControl { new Thread(new Runnable() { @Override public void run() { - while (true) { - Runnable runner; + Runnable runner = null; + do { try { runner = actionQueue.take(); - if (runner == null) { - return; - } - runner.run(); } catch (InterruptedException e) { } - } + } while (runner != STOP_ACTION); } }).start(); @@ -149,7 +151,7 @@ public class ConnectionControl implements IConnectionControl { connection.disconnect(); connection = null; } - ConnectionControl.this.run(null); + ConnectionControl.this.run(STOP_ACTION); } }); } |