diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index 9e4fce7b6..2694e3655 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -130,17 +130,22 @@ public class SocketRyClient { if (mListener == null) { return; } - switch (msg.what) { - case Constants.SOCKET_WHAT_CONN: - mListener.onConnect((Boolean) msg.obj); - break; - case Constants.SOCKET_WHAT_BROADCAST: - processBroadcast((String) msg.obj); - break; - case Constants.SOCKET_WHAT_DISCONN: - mListener.onDisConnect(); - break; + try { + switch (msg.what) { + case Constants.SOCKET_WHAT_CONN: + mListener.onConnect((Boolean) msg.obj); + break; + case Constants.SOCKET_WHAT_BROADCAST: + processBroadcast((String) msg.obj); + break; + case Constants.SOCKET_WHAT_DISCONN: + mListener.onDisConnect(); + break; + } + } catch (Exception e) { + e.printStackTrace(); } + } @@ -211,7 +216,7 @@ public class SocketRyClient { break; } UserBean us = CommonAppConfig.getInstance().getUserBean(); - if (map.getString("uid") != null && map.getString("uid").equals(us.getId())) { + if (map.getString("uid") != null && us != null && map.getString("uid").equals(us.getId())) { int num = LiveAudienceActivity.fansNum + 1; LiveRoomViewHolder.setFansNum(num); }