aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/link_hints.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-04-22 11:59:01 +0100
committerStephen Blott2015-04-22 11:59:01 +0100
commit93e6a4dbac4512a7f1172c3b0c0284557ec80082 (patch)
treeb0e5c9d34d75fced58efd4d7d42deb4e9a1a0463 /content_scripts/link_hints.coffee
parent3d273b68c34e5aeb9fd76d1979ee4606357a8631 (diff)
downloadvimium-93e6a4dbac4512a7f1172c3b0c0284557ec80082.tar.bz2
For "yf", handle case where link.href isn't defined.
Note: We probably shouldn't be offering these links at all.
Diffstat (limited to 'content_scripts/link_hints.coffee')
-rw-r--r--content_scripts/link_hints.coffee11
1 files 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) ->