Fix crashes when going to an invalid diff viewer page number.

Review Request #7024 — Created March 8, 2015 and submitted — Latest diff uploaded

Information

Review Board
release-2.0.x
64cf5d5...

Reviewers

If the user tried to navigate to an invalid diff viewer page (either one
with a bad value or one outside the range of pages), we'd attempt to
render an error message, but would end up causing a crash. The crash
occurred because the template was still expecting a bunch of state to be
set up for the page, and would fail with Invalid Variable errors.

While that part should probably be fixed, we can better handle the case
of invalid page errors. We now catch this and set it to the last page in
the list. We use this value since, in all the errors we've seen on this,
the user was getting into a state where they were trying to reach a page
just past the valid page range.

Tested specifying some invalid pages. Saw that it loaded a diff viewer
page instead of crashing horribly.