Skip to content

Commit 73f4e3f

Browse files
dieselburnerlimdingwen
authored andcommitted
Add strconv.ParseInt error handling
1 parent 4cbc8fe commit 73f4e3f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/settings.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ func (settings *Settings) int64FlagEnv(p *int64, name string, env string, value
6060
flag.Int64Var(p, name, value, usage+" (env "+env+")")
6161
val := os.Getenv(env)
6262
if val != "" {
63-
i, _ := strconv.ParseInt(val, 10, 0)
63+
i, err := strconv.ParseInt(val, 10, 0)
64+
if err != nil {
65+
log.Fatal(err)
66+
}
6467
*p = i
6568
}
6669
}

0 commit comments

Comments
 (0)