From a80141f9f118d99c4202a5b8738951757b1dd2dc Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Jan 2018 10:00:04 +0800 Subject: [PATCH] =?UTF-8?q?func=E4=B8=BA=E7=A9=BA=E4=BC=9A=E5=AF=BC?= =?UTF-8?q?=E8=87=B4judge=E6=9C=8D=E5=8A=A1crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/judge/store/func.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/judge/store/func.go b/modules/judge/store/func.go index 3eee1d372..28466e8c8 100644 --- a/modules/judge/store/func.go +++ b/modules/judge/store/func.go @@ -263,6 +263,9 @@ func atois(s string) (ret []int, err error) { // @str: e.g. all(#3) sum(#3) avg(#10) diff(#10) func ParseFuncFromString(str string, operator string, rightValue float64) (fn Function, err error) { + if str == "" { + return nil, fmt.Errorf("func con't be nil!") + } idx := strings.Index(str, "#") args, err := atois(str[idx+1 : len(str)-1]) if err != nil {