Fix NullPointerException on disconnect
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@534 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
fc3c5a3e28
commit
0b1f9383ce
1 changed files with 10 additions and 8 deletions
|
@ -68,6 +68,12 @@ public class ConnectionControl implements IConnectionControl {
|
||||||
private final static String ELEMENT_NAME = "rummikub";
|
private final static String ELEMENT_NAME = "rummikub";
|
||||||
private final static String NAMESPACE = "http://home.universe-factory.net/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 final LoginData loginData;
|
||||||
private volatile Connection connection;
|
private volatile Connection connection;
|
||||||
private volatile MultiUserChat muc;
|
private volatile MultiUserChat muc;
|
||||||
|
@ -120,18 +126,14 @@ public class ConnectionControl implements IConnectionControl {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (true) {
|
Runnable runner = null;
|
||||||
Runnable runner;
|
do {
|
||||||
try {
|
try {
|
||||||
runner = actionQueue.take();
|
runner = actionQueue.take();
|
||||||
if (runner == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
runner.run();
|
runner.run();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
}
|
}
|
||||||
}
|
} while (runner != STOP_ACTION);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
|
@ -149,7 +151,7 @@ public class ConnectionControl implements IConnectionControl {
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
connection = null;
|
connection = null;
|
||||||
}
|
}
|
||||||
ConnectionControl.this.run(null);
|
ConnectionControl.this.run(STOP_ACTION);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue