diff --git a/plugin/coser/coser.go b/plugin/coser/coser.go index e22a03d980..73b87ed2b9 100644 --- a/plugin/coser/coser.go +++ b/plugin/coser/coser.go @@ -44,6 +44,9 @@ func init() { return "", err } arr := gjson.Get(helper.BytesToString(data), "data.data").Array() + if len(arr) == 0 { + return "", errors.New("data is empty") + } pic := arr[rand.Intn(len(arr))] return pic.String(), nil }, web.GetData, time.Minute)