From 06609b5337646b06e9b29bbbae7fb98a9b37667b Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 5 Nov 2018 11:10:31 +0100 Subject: [PATCH] Prevent errors if `PDFFindController.executeCommand` is ever called without a `state` object Most of the code in `PDFFindController` assumes that a valid `state` always exits, hence it cannot hurt to add a simple check to avoid errors being thrown. --- web/pdf_find_controller.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/pdf_find_controller.js b/web/pdf_find_controller.js index 202c99700..d20a46c40 100644 --- a/web/pdf_find_controller.js +++ b/web/pdf_find_controller.js @@ -111,6 +111,9 @@ class PDFFindController { } executeCommand(cmd, state) { + if (!state) { + return; + } const pdfDocument = this._pdfDocument; if (this._state === null || this._shouldDirtyMatch(cmd, state)) {