fix segfault when a read_file block lacks a path field (#490)
fixes #489
This commit is contained in:
parent
cb516c2df3
commit
c1e9069aa1
@ -19,6 +19,12 @@ void print_file_contents(file_contents_ctx_t *ctx) {
|
|||||||
char *outwalk = ctx->buf;
|
char *outwalk = ctx->buf;
|
||||||
char *buf = scalloc(ctx->max_chars * sizeof(char) + 1);
|
char *buf = scalloc(ctx->max_chars * sizeof(char) + 1);
|
||||||
|
|
||||||
|
if (ctx->path == NULL) {
|
||||||
|
OUTPUT_FULL_TEXT("error: path not configured");
|
||||||
|
free(buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
char *abs_path = resolve_tilde(ctx->path);
|
char *abs_path = resolve_tilde(ctx->path);
|
||||||
int fd = open(abs_path, O_RDONLY);
|
int fd = open(abs_path, O_RDONLY);
|
||||||
free(abs_path);
|
free(abs_path);
|
||||||
|
Loading…
Reference in New Issue
Block a user