diff options
| author | Stephen Blott | 2016-05-06 06:30:33 +0100 |
|---|---|---|
| committer | Stephen Blott | 2016-05-06 06:30:35 +0100 |
| commit | 804fdc96f5dc1698d0ed3872de6c1d78feda2e59 (patch) | |
| tree | f0159e3af03430530ca2a44a3a0b35d525e8b897 /background_scripts | |
| parent | 3959369a69fd058bd2ca723e8aa65c0c5a01c20f (diff) | |
| download | vimium-804fdc96f5dc1698d0ed3872de6c1d78feda2e59.tar.bz2 | |
Fix binary-search OOB.
This affects binary search in the history cache.
The returned index can be one beyond the end of array, and so we get an
error when we look it up blindly. So, we need to check.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/completion.coffee | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 7cd47a00..66ad2e38 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -779,7 +779,7 @@ HistoryCache = # correct "lastVisitTime". That's crucial for ranking Vomnibar suggestions. onPageVisited: (newPage) -> i = HistoryCache.binarySearch(newPage, @history, @compareHistoryByUrl) - pageWasFound = (@history[i].url == newPage.url) + pageWasFound = (@history[i]?.url == newPage.url) if pageWasFound @history[i] = newPage else |
