summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ls.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ls.c b/ls.c
index 03aec00..277811c 100644
--- a/ls.c
+++ b/ls.c
@@ -1,7 +1,7 @@
/*
* UNG's Not GNU
*
- * Copyright (c) 2011-2022, Jakob Kaivo <jkk@ung.org>
+ * Copyright (c) 2011-2023, Jakob Kaivo <jkk@ung.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -450,6 +450,10 @@ static void ls_print_single(size_t n, struct file_info files[static n])
static void ls_print_columns(size_t n, struct file_info files[static n])
{
+ if (n == 0) {
+ return;
+ }
+
size_t widest = ls_find_widest(n, files);
size_t columns = ls_get_columns();
if (widest > columns / 2) {