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

View File

@ -67,18 +67,22 @@ func (m *milkDropWindow) setupPresets(presets []string) {
* preset.
*/
func (m *milkDropWindow) nextPreset(smooth bool) {
if m.preset.Len() > 0 {
m.preset = m.preset.Next()
m.loadPreset(smooth)
}
}
/*
* prevPreset sets the milkDropWindow's preset to the one before the current
* preset.
*/
func (m *milkDropWindow) prevPreset(smooth bool) {
if m.preset.Len() > 0 {
m.preset = m.preset.Prev()
m.loadPreset(smooth)
}
}
/*
* newMilkDropWindow returns a new milkDropWindow with the given width and