From 93e6a4dbac4512a7f1172c3b0c0284557ec80082 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Wed, 22 Apr 2015 11:59:01 +0100 Subject: For "yf", handle case where link.href isn't defined. Note: We probably shouldn't be offering these links at all. --- content_scripts/link_hints.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 6bbe1f07..5404d177 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -95,10 +95,13 @@ LinkHints = else if @mode is COPY_LINK_URL @hintMode.setIndicator "Copy link URL to Clipboard" @linkActivator = (link) => - chrome.runtime.sendMessage handler: "copyToClipboard", data: link.href - url = link.href - url = url[0..25] + "...." if 28 < url.length - @onExit = -> HUD.showForDuration "Yanked #{url}", 2000 + if link.href? + chrome.runtime.sendMessage handler: "copyToClipboard", data: link.href + url = link.href + url = url[0..25] + "...." if 28 < url.length + @onExit = -> HUD.showForDuration "Yanked #{url}", 2000 + else + @onExit = -> HUD.showForDuration "No link to yank.", 2000 else if @mode is OPEN_INCOGNITO @hintMode.setIndicator "Open link in incognito window" @linkActivator = (link) -> -- cgit v1.2.3