From 0b2d25b24390af5534fcd7d609343c594af63367 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Tue, 8 May 2018 22:39:37 +0900 Subject: [PATCH] fix a silly crash in ls --- apps/ls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/ls.c b/apps/ls.c index 128d1c42..b746506c 100644 --- a/apps/ls.c +++ b/apps/ls.c @@ -341,6 +341,8 @@ static int display_dir(char * p) { /* Now, copy those entries into an array (for sorting) */ + if (!ents_list->length) return 0; + struct tfile ** file_arr = malloc(sizeof(struct tfile *) * ents_list->length); int index = 0; foreach(node, ents_list) {