From 06499a6fe60160743eebf4413f99b13d1fd5cff0 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 15 Jun 2019 12:19:01 +0200 Subject: [PATCH] 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. --- lisp/url/url-tramp.el | 8 ++++---- 1 file 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. 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) -- 2.39.5