summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-09-03 19:08:49 +0200
committerBert <ber.t@gmx.com>2011-09-03 19:08:49 +0200
commitc2320a2f49fc4447c2b717f8f3d03b7612e76ab8 (patch)
tree4d8880a965054994f1c60b3a63376517f273090e /main.c
parenta7a849761fed7f829da3874ef6a5b5097a7b9e6a (diff)
downloadnsxiv-c2320a2f49fc4447c2b717f8f3d03b7612e76ab8.tar.zst
Fixed remove_file()
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/main.c b/main.c
index 6fafb8b..cb6e7bd 100644
--- a/main.c
+++ b/main.c
@@ -116,12 +116,12 @@ void remove_file(int n, unsigned char silent) {
exit(!silent);
}
- if (n + 1 < filecnt) {
- if (files[n].path != files[n].name)
- free((void*) files[n].path);
- free((void*) files[n].name);
+ if (files[n].path != files[n].name)
+ free((void*) files[n].path);
+ free((void*) files[n].name);
+
+ if (n + 1 < filecnt)
memmove(files + n, files + n + 1, (filecnt - n - 1) * sizeof(fileinfo_t));
- }
if (n + 1 < tns.cnt) {
memmove(tns.thumbs + n, tns.thumbs + n + 1, (tns.cnt - n - 1) *
sizeof(thumb_t));