Skip to content

Commit 312fdb6

Browse files
committed
Fix diagnostics list crash
Do not try to show the list of diagnostics if there are no diagnostics.
1 parent 2c0d7bf commit 312fdb6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/lsp/diagnostics.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,11 @@ int32_t diagnostics_cmd(struct command_ctx ctx, int argc, const char **argv) {
389389

390390
struct lsp_buffer_diagnostics *d =
391391
diagnostics_for_buffer(lsp_diagnostics_from_server(server), b);
392+
if (d == NULL) {
393+
minibuffer_echo_timeout(2, "no diagnostics for buffer %s", b->name);
394+
return 0;
395+
}
396+
392397
struct buffer *db =
393398
update_diagnostics_buffer(server, ctx.buffers, d->diagnostics, b);
394399
window_set_buffer(ctx.active_window, db);

0 commit comments

Comments
 (0)