From 52e56c892460e7d1f63ca557b705812f08d6d20c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bert=20M=C3=BCnnich?= <ber.t@posteo.de>
Date: Thu, 11 Sep 2014 22:22:51 +0200
Subject: [PATCH] Fixed segfault caused by image removal in thumbnail mode

---
 Makefile | 2 +-
 main.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 4924b83..e6409fa 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = git-20140901
+VERSION = git-20140911
 
 PREFIX    = /usr/local
 MANPREFIX = $(PREFIX)/share/man
diff --git a/main.c b/main.c
index 933c3cd..4e7e34c 100644
--- a/main.c
+++ b/main.c
@@ -187,7 +187,7 @@ void remove_file(int n, bool manual)
 	filecnt--;
 	if (n < tns.cnt)
 		tns.cnt--;
-	if (mode == MODE_THUMB && fileidx >= tns.cnt)
+	if (mode == MODE_THUMB && tns.cnt > 0 && fileidx >= tns.cnt)
 		fileidx = tns.cnt - 1;
 	if (n < alternate)
 		alternate--;