summaryrefslogtreecommitdiff
path: root/helm-utils.el
diff options
context:
space:
mode:
authorChunyang Xu <xuchunyang.me@gmail.com>2016-06-29 15:48:21 +0800
committerChunyang Xu <xuchunyang.me@gmail.com>2016-06-29 16:16:30 +0800
commitae6ba7045aec665fa5d35268f44c53144404d267 (patch)
tree561b1325a82dbe818adc9a0de78df2e017d4adf3 /helm-utils.el
parentd4cadaa44c3b72864624d11cd0b39b5f139c8c02 (diff)
Fix helm-quit-and-find-file for empty selection
`helm-get-selection' returns nil if current selection is empty such as when current source is empty, and we need to ensure nil will not be passed to `string-match' etc, otherwise, a type error will be raised.
Diffstat (limited to 'helm-utils.el')
-rw-r--r--helm-utils.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/helm-utils.el b/helm-utils.el
index e9300c74..1176013e 100644
--- a/helm-utils.el
+++ b/helm-utils.el
@@ -384,8 +384,8 @@ from its directory."
(string-match ffap-url-regexp it))
it (expand-file-name it))
default-directory))
- ((or (file-remote-p sel)
- (file-exists-p sel))
+ ((and (stringp sel) (or (file-remote-p sel)
+ (file-exists-p sel)))
(expand-file-name sel))
;; Grep.
((and grep-line (file-exists-p (car grep-line)))
@@ -395,7 +395,7 @@ from its directory."
(with-current-buffer (get-buffer (car grep-line))
(or (buffer-file-name) default-directory)))
;; Url.
- ((and ffap-url-regexp (string-match ffap-url-regexp sel)) sel)
+ ((and (stringp sel) ffap-url-regexp (string-match ffap-url-regexp sel)) sel)
;; Default.
(t default-preselection))))))
(put 'helm-quit-and-find-file 'helm-only t)