From 24cbae991acf3a32ea409c6c399743db6ef3c13c Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 13 Sep 2018 11:40:12 +0200 Subject: [PATCH] Further ensure that `PDFFindController._requestMatchesCount` won't return broken data (PR 10052 follow-up) This prevents the findbar from intermittently displaying `0 of {number} matches`, which *could* theoretically happen for large and/or slow loading documents. --- web/pdf_find_controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/pdf_find_controller.js b/web/pdf_find_controller.js index e23068601f7288..c2b780f44a594c 100644 --- a/web/pdf_find_controller.js +++ b/web/pdf_find_controller.js @@ -520,7 +520,7 @@ class PDFFindController { // When searching starts, this method may be called before the `pageMatches` // have been counted (in `_calculateMatch`). Ensure that the UI won't show // temporarily broken state when the active find result doesn't make sense. - if (current > total) { + if (current < 1 || current > total) { current = total = 0; } return { current, total, };