From ee5f43a796f6c331142bc381ae0354f578d5200f Mon Sep 17 00:00:00 2001 From: Miguel Young de la Sota Date: Thu, 21 Nov 2024 13:23:33 -0800 Subject: [PATCH] fix crash --- private/buf/buflsp/symbol.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/private/buf/buflsp/symbol.go b/private/buf/buflsp/symbol.go index 1886272ef1..f9c07f577b 100644 --- a/private/buf/buflsp/symbol.go +++ b/private/buf/buflsp/symbol.go @@ -672,7 +672,9 @@ func (w *symbolWalker) Walk(node, parent ast.Node) { case *ast.GroupNode: def := w.newDef(node, node.Name) w.newDef(node, node.Name) - w.newTag(node.Tag, def) + if node.Tag != nil { + w.newTag(node.Tag, def) + } // TODO: also do the name of the generated field. for _, decl := range node.Decls { w.Walk(decl, node) @@ -681,7 +683,9 @@ func (w *symbolWalker) Walk(node, parent ast.Node) { case *ast.FieldNode: def := w.newDef(node, node.Name) w.newRef(node.FldType) - w.newTag(node.Tag, def) + if node.Tag != nil { + w.newTag(node.Tag, def) + } if node.Options != nil { for _, option := range node.Options.Options { w.Walk(option, node) @@ -692,7 +696,9 @@ func (w *symbolWalker) Walk(node, parent ast.Node) { def := w.newDef(node, node.Name) w.newRef(node.MapType.KeyType) w.newRef(node.MapType.ValueType) - w.newTag(node.Tag, def) + if node.Tag != nil { + w.newTag(node.Tag, def) + } if node.Options != nil { for _, option := range node.Options.Options { w.Walk(option, node) @@ -717,7 +723,9 @@ func (w *symbolWalker) Walk(node, parent ast.Node) { case *ast.EnumValueNode: def := w.newDef(node, node.Name) - w.newTag(node.Number, def) + if node.Number != nil { + w.newTag(node.Number, def) + } if node.Options != nil { for _, option := range node.Options.Options { w.Walk(option, node)