From 23be58c4e8f73b409ec4f5ba780c3bdfe1dcf87d Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 28 Nov 2022 16:29:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DIM=E6=B6=88=E6=81=AF=E8=8E=B7?= =?UTF-8?q?=E5=8F=96getUserBean.getId()=E4=B8=BA=E7=A9=BA=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/live/socket/SocketRyClient.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) 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); }