Krolyxon
Commit 674f69f

Branches

Refs →

nsxiv674f69f

Fix file list indexes when deleting last image

Fixes issue #331
Author
Bert Münnich
Date
2018-12-29 18:48 +0100
Committer
Bert Münnich · 2018-12-29 18:51 +0100
Parent
0bf3265
Commit
674f69f2c9525eef60fbdf0bf5fd147a0018e8eb

+3 −3

1 file changed

  1. M main.c +3 −3
M main.c View
@@ -155,11 +155,11 @@ void remove_file(int n, bool manual)
155155 memmove(files + n, files + n + 1, (filecnt - n - 1) * sizeof(*files));
156156 }
157157 filecnt--;
158− if (n < fileidx)
158+ if (fileidx > n || fileidx == filecnt)
159159 fileidx--;
160− if (n < alternate)
160+ if (alternate > n || alternate == filecnt)
161161 alternate--;
162− if (n < markidx)
162+ if (markidx > n || markidx == filecnt)
163163 markidx--;
164164 }
165165