aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/main.c b/main.c
index 421d14f..344d55a 100644
--- a/main.c
+++ b/main.c
@@ -231,14 +231,14 @@ int main(int argc, char **argv) {
}
}
- filecnt = fileidx;
- fileidx = 0;
-
- if (!filecnt) {
+ if (!fileidx) {
fprintf(stderr, "sxiv: no valid image file given, aborting\n");
exit(1);
}
+ filecnt = fileidx;
+ fileidx = options->startnum < filecnt ? options->startnum : filecnt - 1;
+
win_init(&win);
img_init(&img, &win);