From 6d0872a1df0099bfdb59b38244ab6379c5005186 Mon Sep 17 00:00:00 2001 From: johnson Date: Mon, 17 Jun 2019 17:07:55 +0800 Subject: [PATCH] missing nil check for grpc WaitGroup --- subscriber.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/subscriber.go b/subscriber.go index 56cf6db..bac4c20 100644 --- a/subscriber.go +++ b/subscriber.go @@ -231,9 +231,13 @@ func (g *grpcServer) createSubHandler(sb *subscriber, opts server.Options) broke fn = opts.SubWrappers[i-1](fn) } - g.wg.Add(1) + if g.wg != nil { + g.wg.Add(1) + } go func() { - defer g.wg.Done() + if g.wg != nil { + defer g.wg.Done() + } fn(ctx, &rpcMessage{ topic: sb.topic, contentType: ct,