diff --git a/mongo/mongo.go b/mongo/mongo.go index 2f75dc4..fcef51c 100644 --- a/mongo/mongo.go +++ b/mongo/mongo.go @@ -238,6 +238,9 @@ func (m *MongoDB) Find(ctx context.Context, filter bson.M, result interface{}, c optionsKey := fmt.Sprintf("%+v%+v", page, orderBy) redisKey := fmt.Sprintf(redis.List, user.TenantId, collection, filterKey, optionsKey) resultValue := reflect.ValueOf(result) + if resultValue.IsNil() || resultValue.IsZero() { + return errors.New("result不能为空") + } resultValue = resultValue.Elem() listField := resultValue.FieldByName("List") if m.Cache {