Fix out of bounds panic when restoring EQ preset
This commit is contained in:
committed by
Drew Weymouth
parent
ead7364632
commit
ca9a127d33
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user