Ignore empty change type or index in command line parameters
This commit is contained in:
parent
23004084b4
commit
9360d89fe1
6
main.go
6
main.go
|
@ -91,6 +91,9 @@ func getCmdLineParams(logger *log.Logger) (string, []int64, []satel.ChangeType,
|
||||||
allowedTypesStrings := strings.Split(*allowedTypesRaw, ",")
|
allowedTypesStrings := strings.Split(*allowedTypesRaw, ",")
|
||||||
var allowedTypes []satel.ChangeType
|
var allowedTypes []satel.ChangeType
|
||||||
for _, allowedTypeStr := range allowedTypesStrings {
|
for _, allowedTypeStr := range allowedTypesStrings {
|
||||||
|
if len(allowedTypeStr) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
allowedType, err := StringToSatelChangeType(allowedTypeStr)
|
allowedType, err := StringToSatelChangeType(allowedTypeStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatalf("Error trying to understand an allowed type: %s.", err)
|
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, ",")
|
allowedIndexesStrings := strings.Split(*allowedIndexesRaw, ",")
|
||||||
var allowedIndexes []int
|
var allowedIndexes []int
|
||||||
for _, allowedIndexStr := range allowedIndexesStrings {
|
for _, allowedIndexStr := range allowedIndexesStrings {
|
||||||
|
if len(allowedIndexStr) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
allowedIndex, err := strconv.ParseInt(allowedIndexStr, 10, 0)
|
allowedIndex, err := strconv.ParseInt(allowedIndexStr, 10, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatalf("Tried to use a non-int value for one of allowed indexes: %s. That's bad.", allowedIndexStr)
|
logger.Fatalf("Tried to use a non-int value for one of allowed indexes: %s. That's bad.", allowedIndexStr)
|
||||||
|
|
Loading…
Reference in New Issue