summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGurmeen Bindra <gurmeen.bindra@isode.com>2013-08-12 08:58:52 (GMT)
committerGurmeen Bindra <gurmeen.bindra@isode.com>2013-08-12 10:11:31 (GMT)
commit34e195e8e2db1de0b71460afcce2417d34fc7717 (patch)
treed39842a5941b37382dbdf5a6328c8c6674ab6b88 /src/com/isode/stroke/network/JavaConnection.java
parent21c49ad96762ef3af27dd043a044e37b8ef1c22e (diff)
downloadstroke-34e195e8e2db1de0b71460afcce2417d34fc7717.zip
stroke-34e195e8e2db1de0b71460afcce2417d34fc7717.tar.bz2
Null check for selector before trying to close it
It is possible to have a null selector if socketchannel open failed so adding a null check in this patch. Test-information: sanity tested on linux by connecting/reconnecting on an xmpp service on linux Change-Id: Idee180ca4aefd1f743705da674b486dd8acc4922 Reviewer: Nick Hudson <nick.hudson@isode.com> Reviewer: Kevin Smith <kevin.smith@isode.com>
Diffstat (limited to 'src/com/isode/stroke/network/JavaConnection.java')
-rw-r--r--src/com/isode/stroke/network/JavaConnection.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/isode/stroke/network/JavaConnection.java b/src/com/isode/stroke/network/JavaConnection.java
index 2069e33..31b07a0 100644
--- a/src/com/isode/stroke/network/JavaConnection.java
+++ b/src/com/isode/stroke/network/JavaConnection.java
@@ -131,11 +131,16 @@ public class JavaConnection extends Connection implements EventOwner {
} finally {
if(socketChannel_ != null) {
try {
- socketChannel_.close();
- selector_.close();
+ socketChannel_.close();
} catch (IOException ex) {
/* Do we need to return an error if we're already trying to close? */
}
+ if(selector_ != null) {
+ try {
+ selector_.close();
+ } catch (IOException e) {
+ }
+ }
}
}
}