diff options
| author | Michael Albinus | 2019-06-15 12:19:01 +0200 |
|---|---|---|
| committer | Michael Albinus | 2019-06-15 12:19:01 +0200 |
| commit | 06499a6fe60160743eebf4413f99b13d1fd5cff0 (patch) | |
| tree | 35214202da3668c85c90821fa4b112664b681884 | |
| parent | 33c585edd4e228ea24f0d3924571c7d950079073 (diff) | |
| download | emacs-06499a6fe60160743eebf4413f99b13d1fd5cff0.tar.gz emacs-06499a6fe60160743eebf4413f99b13d1fd5cff0.zip | |
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.
| -rw-r--r-- | lisp/url/url-tramp.el | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/url/url-tramp.el b/lisp/url/url-tramp.el index 305635c8d38..f4ec8226511 100644 --- a/lisp/url/url-tramp.el +++ b/lisp/url/url-tramp.el | |||
| @@ -42,9 +42,9 @@ If URL contains a password, it will be added to the `password-data' cache. | |||
| 42 | In case URL is not convertible, nil is returned." | 42 | In case URL is not convertible, nil is returned." |
| 43 | (let* ((obj (url-generic-parse-url (and (stringp url) url))) | 43 | (let* ((obj (url-generic-parse-url (and (stringp url) url))) |
| 44 | (port | 44 | (port |
| 45 | (and (natnump (url-portspec obj)) | 45 | (and obj (natnump (url-portspec obj)) |
| 46 | (number-to-string (url-portspec obj))))) | 46 | (number-to-string (url-portspec obj))))) |
| 47 | (when (member (url-type obj) url-tramp-protocols) | 47 | (when (and obj (member (url-type obj) url-tramp-protocols)) |
| 48 | (when (url-password obj) | 48 | (when (url-password obj) |
| 49 | (password-cache-add | 49 | (password-cache-add |
| 50 | (tramp-make-tramp-file-name | 50 | (tramp-make-tramp-file-name |
| @@ -60,9 +60,9 @@ In case URL is not convertible, nil is returned." | |||
| 60 | In case FILE is not convertible, nil is returned." | 60 | In case FILE is not convertible, nil is returned." |
| 61 | (let* ((obj (ignore-errors (tramp-dissect-file-name file))) | 61 | (let* ((obj (ignore-errors (tramp-dissect-file-name file))) |
| 62 | (port | 62 | (port |
| 63 | (and (stringp (tramp-file-name-port obj)) | 63 | (and obj (stringp (tramp-file-name-port obj)) |
| 64 | (string-to-number (tramp-file-name-port obj))))) | 64 | (string-to-number (tramp-file-name-port obj))))) |
| 65 | (when (member (tramp-file-name-method obj) url-tramp-protocols) | 65 | (when (and obj (member (tramp-file-name-method obj) url-tramp-protocols)) |
| 66 | (url-recreate-url | 66 | (url-recreate-url |
| 67 | (url-parse-make-urlobj | 67 | (url-parse-make-urlobj |
| 68 | (tramp-file-name-method obj) | 68 | (tramp-file-name-method obj) |