Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where pdfDocument is null #5127

Merged
merged 1 commit into from
Aug 4, 2014

Conversation

Hengjie
Copy link
Contributor

@Hengjie Hengjie commented Aug 3, 2014

Happens when no file is loaded

@@ -101,7 +101,9 @@ var SecondaryToolbar = {
},

lastPageClick: function secondaryToolbarLastPageClick(evt) {
PDFView.page = PDFView.pdfDocument.numPages;
if ( PDFView.pdfDocument !== null ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be simplified slightly (also the formatting isn't completely correct), please change it to:

if (PDFView.pdfDocument) {

Once you've addressed this, please squash the commits: https://github.com/mozilla/pdf.js/wiki/Squashing-Commits.

@Snuffleupagus
Copy link
Collaborator

The same issue can also happen when the user presses the End key, hence I suggest solving that case as well here. Changing lines https://github.com/mozilla/pdf.js/blob/master/web/viewer.js#L2379-L2380 to e.g. the following might work:

if (PresentationMode.active || (PDFView.pdfDocument &&
    PDFView.page < PDFView.pdfDocument.numPages)) {

@Hengjie
Copy link
Contributor Author

Hengjie commented Aug 3, 2014

Sure, I'll change those and squash. :)

Happens when no file is loaded
@Hengjie
Copy link
Contributor Author

Hengjie commented Aug 4, 2014

Alright done, let me know if there are any other changes that I should make.

@Snuffleupagus
Copy link
Collaborator

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Aug 4, 2014

From: Bot.io (Linux)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/01aecf0715f0d71/output.txt

Snuffleupagus added a commit that referenced this pull request Aug 4, 2014
Fix issue where pdfDocument is null
@Snuffleupagus Snuffleupagus merged commit 87de3cd into mozilla:master Aug 4, 2014
@Snuffleupagus
Copy link
Collaborator

Looks good; thanks for the patch!

@Hengjie Hengjie deleted the fix-pdfdocument-null branch August 4, 2014 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants