From fa3ab318fa0970b9590db92bf8230336fcbc61a7 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Sat, 27 Feb 2021 11:19:35 +0100 Subject: [PATCH] Protect against empty uris on windows MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Per https://github.com/joaotavora/eglot/issues/630. * eglot.el (eglot--uri-to-path): Check string length Co-authored-by: João Távora GitHub-reference: fix https://github.com/joaotavora/eglot/issues/610 --- lisp/progmodes/eglot.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 017b8200bfa..0cb5839f6d5 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1176,7 +1176,8 @@ If optional MARKER, return a marker instead" "Convert URI to a file path." (when (keywordp uri) (setq uri (substring (symbol-name uri) 1))) (let ((retval (url-filename (url-generic-parse-url (url-unhex-string uri))))) - (if (eq system-type 'windows-nt) (substring retval 1) retval))) + (if (and (eq system-type 'windows-nt) (cl-plusp (length retval))) + (substring retval 1) retval))) (defun eglot--snippet-expansion-fn () "Compute a function to expand snippets. -- 2.39.2