修复开播时可能的空指针错误

This commit is contained in:
zlzw 2022-11-03 10:39:18 +08:00
parent 41fb743bda
commit 302435c068

View File

@ -1,5 +1,6 @@
package com.yunbao.live.views;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.res.Resources;
@ -527,6 +528,11 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
//加入房间成功后可以通过 RCRTCLocalUser 对象发布本地默认音视频流包括麦克风采集的音频和摄像头采集的视频
RCRTCEngine.getInstance().getDefaultVideoStream().setEncoderMirror(true);
if(rtcRoom==null||rtcRoom.getLocalUser()==null){
ToastUtil.show("开播失败 room为空");
((LiveRyAnchorActivity) mContext).endLives();
return;
}
rtcRoom.getLocalUser().publishDefaultLiveStreams(new IRCRTCResultDataCallback<RCRTCLiveInfo>() {
@Override
public void onSuccess(RCRTCLiveInfo rcrtcLiveInfo1) {