Browse Source

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.
Jonas Jenwald 11 years ago
parent
commit
6078901962
  1. 6
      web/viewer.js

6
web/viewer.js

@ -2024,9 +2024,9 @@ window.addEventListener('keydown', function keydown(evt) { @@ -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

Loading…
Cancel
Save