[Pkg-javascript-commits] [pdf.js] 63/139: Prevent a "TypeError: pdfViewer is null" when the viewer loads (PR 5413 followup)

David Prévot taffit at moszumanska.debian.org
Fri Jan 9 21:18:27 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 6078901962062fe807fcb89d70d5c9660163a4ce
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Sat Nov 15 11:38:43 2014 +0100

    Prevent a "TypeError: pdfViewer is null" when the viewer loads (PR 5413 followup)
    
    Currently if you manage to e.g. open the console (with <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>K</kbd>) before the viewer is initialized, the following will be printed in the console: `TypeError: pdfViewer is null`.
    This doesn't cause any actual errors, but nevertheless it seems like something we should avoid.
    
    Followup to PR 5413.
---
 web/viewer.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/web/viewer.js b/web/viewer.js
index adbde58..439fb01 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -2024,9 +2024,9 @@ window.addEventListener('keydown', function keydown(evt) {
   if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {
     // either CTRL or META key with optional SHIFT.
     var pdfViewer = PDFViewerApplication.pdfViewer;
-    var inPresentationMode =
-      pdfViewer.presentationModeState === PresentationModeState.CHANGING ||
-      pdfViewer.presentationModeState === PresentationModeState.FULLSCREEN;
+    var inPresentationMode = pdfViewer &&
+      (pdfViewer.presentationModeState === PresentationModeState.CHANGING ||
+       pdfViewer.presentationModeState === PresentationModeState.FULLSCREEN);
 
     switch (evt.keyCode) {
       case 70: // f

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list