summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authornasrlol <nsrddyn@gmail.com>2025-02-18 21:12:11 +0100
committernasrlol <nsrddyn@gmail.com>2025-02-18 21:12:11 +0100
commitdcf4c564a03f6ebde88e301ff2135a2b2e00dba9 (patch)
tree1589c993c400070e59783052f41423579dc5e611 /main.c
parent9d968cbf5d718210011acc40f69a456a3b7c4836 (diff)
handling segmentation fault
Signed-off-by: nasrlol <nsrddyn@gmail.com>
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 4 insertions, 0 deletions
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