Skip to content

Commit

Permalink
fix: add nil check for GetSymbolTreeCtx
Browse files Browse the repository at this point in the history
  • Loading branch information
nedpals committed Jan 29, 2024
1 parent 494c34f commit f07aab2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions symbol_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ func WithSymbolTree(tree *SymbolTree) context.Context {
}

func GetSymbolTreeCtx(ctx context.Context) *SymbolTree {
if tree, ok := ctx.Value(symbolTreeKey{}).(*SymbolTree); ok {
return tree
if ctx != nil {
if tree, ok := ctx.Value(symbolTreeKey{}).(*SymbolTree); ok {
return tree
}
}
return nil
}
Expand Down

0 comments on commit f07aab2

Please sign in to comment.