diff --git a/OverlayFormObj/OverlayForm.cs b/OverlayFormObj/OverlayForm.cs index d0c7dd3..11a84b4 100644 --- a/OverlayFormObj/OverlayForm.cs +++ b/OverlayFormObj/OverlayForm.cs @@ -450,13 +450,13 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e) // 如果目前不在 UI 執行緒上,必須透過 Invoke 安全執行 UI 更新邏輯 Console.WriteLine("SongDisplayTimer_Tick invoked on UI thread."); - MainForm.Invoke(new System.Action(() => + MainForm.BeginInvoke(new Action(() => { - // 清除目前歌曲的顯示標籤文字 - MainForm.songDisplayLabel.Text = ""; + if (MainForm.songDisplayLabel != null) + MainForm.songDisplayLabel.Text = ""; - // 顯示下一首歌的標籤 - MainForm.nextSongLabel.Visible = true; + if (MainForm.nextSongLabel != null) + MainForm.nextSongLabel.Visible = true; })); } else