From ac1300ae0043ecca645c9af54130a229727860fa Mon Sep 17 00:00:00 2001 From: Bert Münnich Date: Mon, 31 Oct 2011 11:46:56 +0100 Subject: Fixed issue #25: invalid file cnt and sel in thumb mode --- commands.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'commands.c') 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 { -- cgit v1.2.3-70-g09d2