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()
m.loadPreset(false)
if len(args) > 0 {
m.loadPreset(false)
}
running := true
for running {

View File

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