From b02abc8eb13d582a390acbdb63d6c9c541be018a Mon Sep 17 00:00:00 2001 From: xalanq Date: Thu, 11 Apr 2019 09:21:54 +0800 Subject: [PATCH] Fix some err bugs --- cmd/cmd.go | 3 +++ cmd/parse.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/cmd.go b/cmd/cmd.go index 9e2f4119..86bf83ac 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -119,6 +119,9 @@ func getCode(args map[string]interface{}, templates []config.CodeTemplate) (code return } paths, err := ioutil.ReadDir(path) + if err != nil { + return + } for _, path := range paths { name := path.Name() diff --git a/cmd/parse.go b/cmd/parse.go index 1eea8746..a407cefa 100644 --- a/cmd/parse.go +++ b/cmd/parse.go @@ -26,7 +26,7 @@ func Parse(args map[string]interface{}) error { } return cln.ParseContest(contestID, currentPath) } - if err := work(); err != nil { + if err = work(); err != nil { if err = loginAgain(cfg, cln, err); err == nil { err = work() }