Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/ls/findallreferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ func (l *LanguageService) getReferencedSymbolsForNode(ctx context.Context, posit

if node.Kind == ast.KindSourceFile {
resolvedRef := getReferenceAtPosition(node.AsSourceFile(), position, program)
if resolvedRef.file == nil {
if resolvedRef == nil || resolvedRef.file == nil {
return nil
}
Comment on lines +619 to 621
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nil check for resolvedRef should be performed before accessing any of its fields. Consider splitting this into two separate checks for better readability and to avoid potential short-circuit evaluation issues: first check if resolvedRef == nil and return early, then check if resolvedRef.file == nil.

Suggested change
if resolvedRef == nil || resolvedRef.file == nil {
return nil
}
if resolvedRef == nil {
return nil
}
if resolvedRef.file == nil {
return nil
}

Copilot uses AI. Check for mistakes.


Expand Down
Loading