From 569a76077ee63ea770750d67b8781cab917c05b2 Mon Sep 17 00:00:00 2001 From: sanchitgarg1909 Date: Sun, 22 May 2016 23:55:12 +0530 Subject: [PATCH] added check if username is null --- .../com/github/nkzawa/socketio/androidchat/MainFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/nkzawa/socketio/androidchat/MainFragment.java b/app/src/main/java/com/github/nkzawa/socketio/androidchat/MainFragment.java index 43e1fce..abf5349 100644 --- a/app/src/main/java/com/github/nkzawa/socketio/androidchat/MainFragment.java +++ b/app/src/main/java/com/github/nkzawa/socketio/androidchat/MainFragment.java @@ -273,7 +273,8 @@ public void call(Object... args) { @Override public void run() { if(!isConnected) { - mSocket.emit("add user", mUsername); + if(null!=mUsername) + mSocket.emit("add user", mUsername); Toast.makeText(getActivity().getApplicationContext(), R.string.connect, Toast.LENGTH_LONG).show(); isConnected = true;