From 9360d89fe1a39c2913e9a840d2feb16a02b9d910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Rudowicz?= Date: Sun, 18 Feb 2024 19:19:10 +0100 Subject: [PATCH] Ignore empty change type or index in command line parameters --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 2b2c2db..60f4540 100644 --- a/main.go +++ b/main.go @@ -91,6 +91,9 @@ func getCmdLineParams(logger *log.Logger) (string, []int64, []satel.ChangeType, allowedTypesStrings := strings.Split(*allowedTypesRaw, ",") var allowedTypes []satel.ChangeType for _, allowedTypeStr := range allowedTypesStrings { + if len(allowedTypeStr) == 0 { + continue + } allowedType, err := StringToSatelChangeType(allowedTypeStr) if err != nil { logger.Fatalf("Error trying to understand an allowed type: %s.", err) @@ -100,6 +103,9 @@ func getCmdLineParams(logger *log.Logger) (string, []int64, []satel.ChangeType, allowedIndexesStrings := strings.Split(*allowedIndexesRaw, ",") var allowedIndexes []int for _, allowedIndexStr := range allowedIndexesStrings { + if len(allowedIndexStr) == 0 { + continue + } allowedIndex, err := strconv.ParseInt(allowedIndexStr, 10, 0) if err != nil { logger.Fatalf("Tried to use a non-int value for one of allowed indexes: %s. That's bad.", allowedIndexStr)