From 1b204171fe2116f2dfda6f9d7f12e7f697a796a2 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Tue, 26 Jul 2022 21:52:28 +0100 Subject: [PATCH] Do not emit hyperlinks for missing files --- src/diag.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/diag.c b/src/diag.c index d50dd049..e215c0a0 100644 --- a/src/diag.c +++ b/src/diag.c @@ -580,8 +580,11 @@ static void diag_emit_loc(const loc_t *loc, FILE *f) const char *file = loc_file_str(loc); char *abspath LOCAL = realpath(file, NULL); - color_fprintf(f, "$$$link:file://%s#%u\07%s:%u$\n", - abspath, loc->first_line, file, loc->first_line); + if (abspath != NULL) + color_fprintf(f, "$$$link:file://%s#%u\07%s:%u$\n", + abspath, loc->first_line, file, loc->first_line); + else + fprintf(f, "%s:%u\n", file, loc->first_line); } static void diag_emit_hints(diag_t *d, FILE *f) -- 2.39.2