summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBert Münnich <ber.t@gmx.com>2011-10-31 11:46:56 +0100
committerBert Münnich <ber.t@gmx.com>2011-10-31 11:46:56 +0100
commitac1300ae0043ecca645c9af54130a229727860fa (patch)
treea6e4cef2aee4e3506dbe01a0cdbecdf9c7006ddd
parent1cdbeb972a64e1fb12db5dc05fbaa1428e72bb12 (diff)
downloadnsxiv-ac1300ae0043ecca645c9af54130a229727860fa.tar.zst
Fixed issue #25: invalid file cnt and sel in thumb mode
-rw-r--r--Makefile2
-rw-r--r--commands.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index d6360b8..916f7b7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = git-20111027
+VERSION = git-20111031
CC = gcc
CFLAGS = -ansi -Wall -pedantic -O2
diff --git a/commands.c b/commands.c
index a8b9e77..89dcf8d 100644
--- a/commands.c
+++ b/commands.c
@@ -69,7 +69,10 @@ bool it_switch_mode(arg_t a) {
img.slideshow = false;
reset_timeout(slideshow);
}
- tns.sel = fileidx;
+ if (fileidx < tns.cnt)
+ tns.sel = fileidx;
+ else
+ tns.sel = tns.cnt > 0 ? tns.cnt - 1 : 0;
tns.dirty = true;
mode = MODE_THUMB;
} else {