From 241589424d9612b913ef7f5502839ee6ab2151bc Mon Sep 17 00:00:00 2001 From: ShubhamDesai <42180509+ShubhamDesai@users.noreply.github.com> Date: Wed, 16 Oct 2024 04:08:22 -0400 Subject: [PATCH] r.in.gridatb: check if opening of file succeeds (#4532) --- raster/r.in.gridatb/file_io.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/raster/r.in.gridatb/file_io.c b/raster/r.in.gridatb/file_io.c index 256f9869473..52ad174df4d 100644 --- a/raster/r.in.gridatb/file_io.c +++ b/raster/r.in.gridatb/file_io.c @@ -12,6 +12,9 @@ void rdwr_gridatb(void) float idx; fp = fopen(file, "r"); + if (!fp) { + G_fatal_error(_("Unable to open file: %s"), file); + } buf[0] = 0; if (fscanf(fp, "%[^\n]", buf) != 1)