From 674f69f2c9525eef60fbdf0bf5fd147a0018e8eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Sat, 29 Dec 2018 18:48:23 +0100 Subject: Fix file list indexes when deleting last image Fixes issue #331 --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 2fa26a6..8adbf78 100644 --- a/main.c +++ b/main.c @@ -155,11 +155,11 @@ void remove_file(int n, bool manual) memmove(files + n, files + n + 1, (filecnt - n - 1) * sizeof(*files)); } filecnt--; - if (n < fileidx) + if (fileidx > n || fileidx == filecnt) fileidx--; - if (n < alternate) + if (alternate > n || alternate == filecnt) alternate--; - if (n < markidx) + if (markidx > n || markidx == filecnt) markidx--; } -- cgit v1.2.3