From d2c67863777a84ddb759189ab74cc4cdc2a2d234 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 9 Oct 2024 10:03:48 -0400 Subject: Fixes null value when the input path did not exist --- src/stasis_indexer.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/stasis_indexer.c') diff --git a/src/stasis_indexer.c b/src/stasis_indexer.c index b703ec5..8ca7f44 100644 --- a/src/stasis_indexer.c +++ b/src/stasis_indexer.c @@ -762,6 +762,12 @@ int main(int argc, char *argv[]) { int i = 0; while (optind < argc) { + if (argv[optind]) { + if (access(argv[optind], F_OK) < 0) { + fprintf(stderr, "%s: %s\n", argv[optind], strerror(errno)); + exit(1); + } + } // use first positional argument rootdirs[i] = realpath(argv[optind], NULL); optind++; -- cgit