aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2013-11-16 20:19:55 +0100
committerBert Münnich <ber.t@posteo.de>2013-11-16 20:19:55 +0100
commitcc479ca5ac5ec5050d7acf4c01a3a8e487072ae1 (patch)
tree774551bf7b1fbfa980b44fa8e294e3c286c799ff
parent091aacb4626982c1766ded6574c0599e3bdd14c7 (diff)
Fixed segfault when removing first image from file list, fixes issue #112
-rw-r--r--Makefile2
-rw-r--r--main.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 6c7fd4e..2e892fd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = git-20131114
+VERSION = git-20131116
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
diff --git a/main.c b/main.c
index b1140cb..d50cf66 100644
--- a/main.c
+++ b/main.c
@@ -296,7 +296,7 @@ void load_image(int new)
remove_file(new, false);
if (new >= filecnt)
new = filecnt - 1;
- else if (new < fileidx)
+ else if (new > 0 && new < fileidx)
new--;
}
files[new].loaded = true;
@@ -532,7 +532,7 @@ void run(void)
tns.cnt++;
} else {
remove_file(tns.cnt, false);
- if (tns.sel >= tns.cnt)
+ if (tns.sel > 0 && tns.sel >= tns.cnt)
tns.sel--;
}
if (tns.cnt == filecnt)