don't crash when no presets are passed

This commit is contained in:
filifa 2024-09-07 19:20:09 -05:00
parent 6d045ff304
commit 1e87393d07
2 changed files with 11 additions and 5 deletions

View File

@ -150,7 +150,9 @@ func milkbucket(cmd *cobra.Command, args []string) {
} }
defer m.destroy() defer m.destroy()
if len(args) > 0 {
m.loadPreset(false) m.loadPreset(false)
}
running := true running := true
for running { for running {

View File

@ -67,8 +67,10 @@ func (m *milkDropWindow) setupPresets(presets []string) {
* preset. * preset.
*/ */
func (m *milkDropWindow) nextPreset(smooth bool) { func (m *milkDropWindow) nextPreset(smooth bool) {
if m.preset.Len() > 0 {
m.preset = m.preset.Next() m.preset = m.preset.Next()
m.loadPreset(smooth) m.loadPreset(smooth)
}
} }
/* /*
@ -76,8 +78,10 @@ func (m *milkDropWindow) nextPreset(smooth bool) {
* preset. * preset.
*/ */
func (m *milkDropWindow) prevPreset(smooth bool) { func (m *milkDropWindow) prevPreset(smooth bool) {
if m.preset.Len() > 0 {
m.preset = m.preset.Prev() m.preset = m.preset.Prev()
m.loadPreset(smooth) m.loadPreset(smooth)
}
} }
/* /*