Bound returned page by number of pages - 1

Closes: #404

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2014-06-23 21:14:14 +02:00
parent aaa5467305
commit 3d96d44095

View file

@ -81,7 +81,7 @@ position_to_page_number(zathura_document_t* document, double pos_x,
if (page < c0 - 1) {
return 0;
} else {
return page - (c0 - 1);
return MIN(page - (c0 - 1), npag - 1);
}
}