Skip to content

Commit

Permalink
Fixed crash on a no-argument message
Browse files Browse the repository at this point in the history
If a message from the socket.io server is emitted with no arguments, it
now is properly received
  • Loading branch information
bkase committed Jan 2, 2013
1 parent e088b9e commit 6adfa2a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/com/codebutler/android_websockets/SocketIOClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ public void onMessage(String message) {
final String dataString = parts[3];
JSONObject data = new JSONObject(dataString);
String event = data.getString("name");
JSONArray args = data.getJSONArray("args");
JSONArray args;
try {
args = data.getJSONArray("args");
} catch (JSONException e) {
args = new JSONArray();
}
if (!"".equals(messageId)) {
mSendHandler.post(new Runnable() {
@Override
Expand Down

0 comments on commit 6adfa2a

Please sign in to comment.