Skip to content

Commit

Permalink
Check for zero-length file
Browse files Browse the repository at this point in the history
Intra-file links such as [top](#top) would result in the variable file
being a zero-length string.
  • Loading branch information
jrblevin committed May 6, 2016
1 parent 77f7706 commit 619d813
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -6211,7 +6211,9 @@ Otherwise, open with `find-file' after stripping anchor and/or query string."
(string-match "\\?" file))
(setq file (substring file 0 (match-beginning 0))))))
;; Open full URLs in browser, files in Emacs
(if full (browse-url link) (when file (find-file file))))
(if full
(browse-url link)
(when (and file (> (length file) 0)) (find-file file))))
(error "Point is not at a Markdown link or URI")))


Expand Down

0 comments on commit 619d813

Please sign in to comment.