在获取弹幕时抛异常后尝试关闭数据库

This commit is contained in:
zlzw 2024-11-28 18:21:50 +08:00
parent 52e4312a32
commit 3f10e19e50

View File

@ -89,6 +89,7 @@ public class LiveDanmuService {
public LiveVideoDanmu getDanmu(String roomId, String videoId, int page) {
LiveVideoDanmu danmus = new LiveVideoDanmu();
BiliLiveDatabase liveDatabase = new BiliLiveDatabase(LiveRoomConfig.buildConfig(roomId));
try {
LiveVideoDatabaseBean videoBean = liveDatabase.getVideo(videoId);
if (videoBean == null) {
return new LiveVideoDanmu();
@ -118,7 +119,12 @@ public class LiveDanmuService {
danmus.getSuperChat().add(superChat);
}
} catch (Exception e) {
Log.e(e);
} finally {
liveDatabase.close();
}
return danmus;
}