Fix out of bounds panic when restoring EQ preset

This commit is contained in:
Gianluca Boiano
2026-02-10 08:13:39 -08:00
committed by Drew Weymouth
parent ead7364632
commit ca9a127d33
+7
View File
@@ -481,6 +481,13 @@ func (s *SettingsDialog) createPlaybackTab(isLocalPlayer, isReplayGainPlayer boo
} }
func (s *SettingsDialog) createEqualizerTab(eqBands []string) *container.TabItem { func (s *SettingsDialog) createEqualizerTab(eqBands []string) *container.TabItem {
// Ensure GraphicEqualizerBands matches the expected number of bands
if len(s.config.LocalPlayback.GraphicEqualizerBands) != len(eqBands) {
newBands := make([]float64, len(eqBands))
copy(newBands, s.config.LocalPlayback.GraphicEqualizerBands)
s.config.LocalPlayback.GraphicEqualizerBands = newBands
}
enabled := widget.NewCheck(lang.L("Enabled"), func(b bool) { enabled := widget.NewCheck(lang.L("Enabled"), func(b bool) {
s.config.LocalPlayback.EqualizerEnabled = b s.config.LocalPlayback.EqualizerEnabled = b
if s.OnEqualizerSettingsChanged != nil { if s.OnEqualizerSettingsChanged != nil {