Skip to content

Commit

Permalink
fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
mcy committed Nov 21, 2024
1 parent 5c43a09 commit ee5f43a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions private/buf/buflsp/symbol.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit ee5f43a

Please sign in to comment.