Skip to content

Commit

Permalink
add check for nil before derefrencing *link
Browse files Browse the repository at this point in the history
  • Loading branch information
julioc-lopez committed Jan 9, 2024
1 parent bc8fb81 commit 0a5a6ff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/adapter/lsp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,12 @@ func NewServer(opts ServerOpts) *Server {
}
}

if link == nil {
return nil, fmt.Errorf("no link for %s:%v", params.TextDocument.URI, params.Position.Line)
}

target, err := server.noteForLink(*link, notebook)
if link == nil || target == nil || err != nil {
if target == nil || err != nil {
return nil, err
}

Expand Down

0 comments on commit 0a5a6ff

Please sign in to comment.