Rikka仿网易云音乐项目,点击云村,其他人分享的音乐报错
Attempt to invoke interface method 'java.lang.Object java.util.List.get(int)' on a null object reference
报错文件
person/adapter/UserEventAdapter.java
代码
rlShare.setOnClickListener(v -> {
intent.setClass(mContext, SongActivity.class);
SongInfo songInfo = new SongInfo();
if (jsonBean.getSong() != null) {
UserEventJsonBean.SongBean songBean = new UserEventJsonBean.SongBean();
songInfo.setDuration(songBean.getDuration());
// 报错行数310
songInfo.setArtist(songBean.getArtists().get(0).getName()); // 作者名
songInfo.setSongId(String.valueOf(songBean.getId())); // 歌曲ID
songInfo.setSongUrl(SONG_URL + songInfo.getSongId() + ".mp3"); // 歌曲URl
songInfo.setSongName(songBean.getName()); // 歌曲名称
songInfo.setSongCover(songBean.getAlbum().getBlurPicUrl()); // 歌曲图片URL
}
因为怕获取的URL内容过旧,有尝试过把UserEventJsonBean内容全部重写一遍