Explorar o código

fix nil pointer if group not exists (#1773)

Co-authored-by: anqiansong <anqiansong@bytedance.com>
anqiansong %!s(int64=3) %!d(string=hai) anos
pai
achega
252fabcc4b
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      tools/goctl/api/parser/g4/ast/apiparser.go

+ 1 - 1
tools/goctl/api/parser/g4/ast/apiparser.go

@@ -253,7 +253,7 @@ func (p *Parser) duplicateRouteCheck(nestedApi *Api, mainHandlerMap, mainRouteMa
 				prefix = p.Text()
 			}
 			g := each.AtServer.Kv.Get(groupKey)
-			if p != nil {
+			if g != nil {
 				group = g.Text()
 			}
 		}