Make url-tramp more robust

* lisp/url/url-tramp.el (url-tramp-convert-url-to-tramp)
(url-tramp-convert-tramp-to-url): Check, that obj is non-nil.
This commit is contained in:
Michael Albinus 2019-06-15 12:19:01 +02:00
parent 33c585edd4
commit 06499a6fe6

View file

@ -42,9 +42,9 @@ If URL contains a password, it will be added to the `password-data' cache.
In case URL is not convertible, nil is returned."
(let* ((obj (url-generic-parse-url (and (stringp url) url)))
(port
(and (natnump (url-portspec obj))
(and obj (natnump (url-portspec obj))
(number-to-string (url-portspec obj)))))
(when (member (url-type obj) url-tramp-protocols)
(when (and obj (member (url-type obj) url-tramp-protocols))
(when (url-password obj)
(password-cache-add
(tramp-make-tramp-file-name
@ -60,9 +60,9 @@ In case URL is not convertible, nil is returned."
In case FILE is not convertible, nil is returned."
(let* ((obj (ignore-errors (tramp-dissect-file-name file)))
(port
(and (stringp (tramp-file-name-port obj))
(and obj (stringp (tramp-file-name-port obj))
(string-to-number (tramp-file-name-port obj)))))
(when (member (tramp-file-name-method obj) url-tramp-protocols)
(when (and obj (member (tramp-file-name-method obj) url-tramp-protocols))
(url-recreate-url
(url-parse-make-urlobj
(tramp-file-name-method obj)