From 5cbc5ad702a01a81b98f8c82edb3b6d227c2c7b5 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 21 Feb 2016 16:19:43 +0000 Subject: Fix divide by zero. If text.length is 1, here, then we divide by `log 1` - which is zero. So add one. --- content_scripts/link_hints.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'content_scripts') diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 699c911a..8d75ed32 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -637,7 +637,7 @@ class FilterHints score = searchWordScores.reduce addFunc, 0 # Prefer matches in shorter texts. To keep things balanced for links without any text, we just weight # them as if their length was 50. - score / Math.log(text.length || 50) + score / Math.log 1 + (text.length || 50) # # Make each hint character a span, so that we can highlight the typed characters as you type them. -- cgit v1.2.3