Skip to content

Commit

Permalink
fix: Nil pointer derefer
Browse files Browse the repository at this point in the history
  • Loading branch information
dwisiswant0 committed Feb 16, 2022
1 parent 6933a71 commit d4f35d0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ func main() {
sc = bufio.NewScanner(os.Stdin)
} else if fn != "" {
r, err := os.Open(fn)
if err == nil {
sc = bufio.NewScanner(r)
if err != nil {
panic(err)
}

sc = bufio.NewScanner(r)
} else {
return
}

for sc.Scan() {
Expand Down

0 comments on commit d4f35d0

Please sign in to comment.