From dcf4c564a03f6ebde88e301ff2135a2b2e00dba9 Mon Sep 17 00:00:00 2001 From: nasrlol Date: Tue, 18 Feb 2025 21:12:11 +0100 Subject: handling segmentation fault Signed-off-by: nasrlol --- main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.c b/main.c index 17e0469..80a5fe7 100644 --- a/main.c +++ b/main.c @@ -22,6 +22,10 @@ void test() { void ls(const char *path) { struct dirent *entry; + if (path == NULL) { + printf("No path found\n"); + return; + } DIR *dP = opendir(path); // check if the directory got opened successfully -- cgit v1.2.3-70-g09d2