Verify the page number exists.

This commit is contained in:
Timmy Crawford 2018-08-01 11:51:11 -07:00
parent f93421c750
commit 2e3788a862
1 changed files with 1 additions and 1 deletions

View File

@ -57,7 +57,7 @@ class Pagination extends Component {
const { onPageChange } = this.props; const { onPageChange } = this.props;
const newPage = parseInt( event.target.value, 10 ); const newPage = parseInt( event.target.value, 10 );
if ( isFinite( newPage ) ) { if ( isFinite( newPage ) && this.pageCount && this.pageCount >= newPage ) {
onPageChange( newPage ); onPageChange( newPage );
} }
} }