sfm

simple file manager
git clone git://git.afify.dev/sfm
Log | Files | Refs | README | LICENSE

commit fd8c384738dfd8a71f875816c38cfe724ac013f0
parent ce3440623e39d43a1f7f2357ecb5ebd248eeb655
Author: afify <hassan@afify.dev>
Date:   Tue, 25 May 2021 15:41:34 +0300

[fix] empty dir actions

- calcdir(), delfd(), start_vmode(), rname(), yank() :
	check if dirc > 1 else return

Diffstat:
Msfm.c | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/sfm.c b/sfm.c @@ -685,6 +685,8 @@ delent(char *fullpath) static void calcdir(void) { + if (cpane->dirc < 1) + return; if (!S_ISDIR(CURSOR(cpane).mode)) return; @@ -758,6 +760,8 @@ crnf(void) static void delfd(void) { + if (cpane->dirc < 1) + return; switch (delent(CURSOR(cpane).name)) { case -1: print_error(strerror(errno)); @@ -1302,6 +1306,8 @@ start_filter(void) static void start_vmode(void) { + if (cpane->dirc < 1) + return; struct tb_event fev; if (selection != NULL) { free(selection); @@ -1527,6 +1533,8 @@ selmv(void) static void rname(void) { + if (cpane->dirc < 1) + return; char new_name[MAX_P]; char *input_name; @@ -1554,6 +1562,8 @@ rname(void) static void yank(void) { + if (cpane->dirc < 1) + return; yank_file[0] = CURSOR(cpane).name; print_status(cprompt, "1 file is yanked", selection_size); }