summaryrefslogtreecommitdiff
path: root/platform/gl/gl-main.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-09-03 12:25:32 +0200
committerTor Andersson <tor.andersson@artifex.com>2015-10-06 11:21:23 +0200
commite982f5c7dd626b5b6051a835dd33c817100f7c2d (patch)
treedd82881e90ce19fe0dd6b6dae4670a4441ac0e84 /platform/gl/gl-main.c
parent32d57390d9de2f9d9bdf55823038fea7fde4bc3f (diff)
downloadmupdf-e982f5c7dd626b5b6051a835dd33c817100f7c2d.tar.xz
gl: Don't try searching outside the document.
Diffstat (limited to 'platform/gl/gl-main.c')
-rw-r--r--platform/gl/gl-main.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
index aee84103..d85b7df7 100644
--- a/platform/gl/gl-main.c
+++ b/platform/gl/gl-main.c
@@ -863,9 +863,12 @@ static void do_app(void)
search_page = currentpage + search_dir;
else
search_page = currentpage;
- search_hit_page = -1;
- if (search_needle)
- search_active = 1;
+ if (search_page >= 0 && search_page < fz_count_pages(ctx, doc))
+ {
+ search_hit_page = -1;
+ if (search_needle)
+ search_active = 1;
+ }
break;
case 'n':
search_dir = 1;
@@ -873,9 +876,12 @@ static void do_app(void)
search_page = currentpage + search_dir;
else
search_page = currentpage;
- search_hit_page = -1;
- if (search_needle)
- search_active = 1;
+ if (search_page >= 0 && search_page < fz_count_pages(ctx, doc))
+ {
+ search_hit_page = -1;
+ if (search_needle)
+ search_active = 1;
+ }
break;
case 'f': toggle_fullscreen(); break;
case 'w': shrinkwrap(); break;