在获取弹幕时抛异常后尝试关闭数据库
This commit is contained in:
parent
52e4312a32
commit
3f10e19e50
@ -89,6 +89,7 @@ public class LiveDanmuService {
|
|||||||
public LiveVideoDanmu getDanmu(String roomId, String videoId, int page) {
|
public LiveVideoDanmu getDanmu(String roomId, String videoId, int page) {
|
||||||
LiveVideoDanmu danmus = new LiveVideoDanmu();
|
LiveVideoDanmu danmus = new LiveVideoDanmu();
|
||||||
BiliLiveDatabase liveDatabase = new BiliLiveDatabase(LiveRoomConfig.buildConfig(roomId));
|
BiliLiveDatabase liveDatabase = new BiliLiveDatabase(LiveRoomConfig.buildConfig(roomId));
|
||||||
|
try {
|
||||||
LiveVideoDatabaseBean videoBean = liveDatabase.getVideo(videoId);
|
LiveVideoDatabaseBean videoBean = liveDatabase.getVideo(videoId);
|
||||||
if (videoBean == null) {
|
if (videoBean == null) {
|
||||||
return new LiveVideoDanmu();
|
return new LiveVideoDanmu();
|
||||||
@ -118,7 +119,12 @@ public class LiveDanmuService {
|
|||||||
danmus.getSuperChat().add(superChat);
|
danmus.getSuperChat().add(superChat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(e);
|
||||||
|
} finally {
|
||||||
liveDatabase.close();
|
liveDatabase.close();
|
||||||
|
}
|
||||||
|
|
||||||
return danmus;
|
return danmus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user