From ba5ac33e93981985898fc083e7944ecba06c2d8e Mon Sep 17 00:00:00 2001 From: Matti Ranta Date: Mon, 15 Apr 2019 11:32:56 -0400 Subject: [PATCH] check if schedule len > 0 to prevent collisions --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 6936342..480b472 100644 --- a/main.go +++ b/main.go @@ -66,10 +66,11 @@ func before(c *cli.Context) error { pollingSet := c.IsSet("interval") cronSet := c.IsSet("schedule") + cronLen := len(c.String("schedule")) - if pollingSet && cronSet { + if pollingSet && cronSet && cronLen > 0 { log.Fatal("Only schedule or interval can be defined, not both.") - } else if cronSet { + } else if cronSet && cronLen > 0 { scheduleSpec = c.String("schedule") } else { scheduleSpec = "@every " + strconv.Itoa(c.Int("interval")) + "s"