diff --git a/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricSwitchView.java b/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricSwitchView.java index edfb9fdae..3678963e4 100644 --- a/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricSwitchView.java +++ b/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricSwitchView.java @@ -120,6 +120,7 @@ public Animation outAnim(String str, float height) { } private void setAnima() { + if (textView == null) return; if (isShowAnima) { float size = textView.getTextSize(); setInAnimation(inAnim("top", size)); @@ -141,7 +142,9 @@ public CharSequence getText() { } public TextPaint getPaint() { - return ((TextView)this.getCurrentView()).getPaint(); + TextView v = (TextView)this.getCurrentView(); + if (v == null) return null; + return v.getPaint(); } public void setWidth(int i) { diff --git a/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricView.java b/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricView.java index 31624eca7..32c999908 100644 --- a/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricView.java +++ b/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricView.java @@ -138,6 +138,7 @@ private boolean updateWH() { } private void setLayoutParamsHeight() { + if (textView == null) return; int height = textView.getPaint().getFontMetricsInt(null) * maxLineNum; if (height > maxHeight - 100) height = maxHeight - 100; layoutParams.height = height; @@ -166,7 +167,7 @@ private void updateViewPosition() { int width = (int)(maxWidth * widthPercentage); if (layoutParams.width != width) { layoutParams.width = width; - textView.setWidth(width); + if (textView != null) textView.setWidth(width); } fixViewPosition(); @@ -382,6 +383,7 @@ public void setLyric(String text, ArrayList extendedLyrics) { } text = textBuilder.toString(); } + if (textView == null) return; textView.setText(text); } diff --git a/publish/changeLog.md b/publish/changeLog.md index 851e817c3..8b58a3342 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -6,6 +6,10 @@ - 新增重复歌曲列表,可以方便移除我的列表中的重复歌曲,此列表会列出目标列表里歌曲名相同的歌曲,可在“我的列表”里的列表名菜单中使用(注:该功能与PC端的区别是可以点击歌曲名多选删除) - 新增打开当前歌曲详情页菜单,可以在歌曲菜单中使用 +### 修复 + +- 修复潜在桌面歌词导致的崩溃问题 + ### 其他 - 更新 React native 到 v0.73.9