Эх сурвалжийг харах

修复im-server空指针异常的问题

xie.bx 3 жил өмнө
parent
commit
1b72be4ff7

+ 6 - 6
im-server/src/main/java/com/bx/imserver/websocket/WebsocketChannelCtxHolder.java

@@ -18,16 +18,16 @@ public class WebsocketChannelCtxHolder {
     }
 
     public static void  removeChannelCtx(Long userId){
-        channelMap.remove(userId);
+        if(userId != null){
+            channelMap.remove(userId);
+        }
     }
 
     public static ChannelHandlerContext  getChannelCtx(Long userId){
+        if(userId == null){
+            return  null;
+        }
         return channelMap.get(userId);
     }
 
-    public static Set<Long> getAllChannelIds(){
-        return channelMap.keySet();
-    }
-
-
 }