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;