From 5b1d0da4cf922c64dd394f5b458aea3154c1922d Mon Sep 17 00:00:00 2001 From: Sebastian Sturm Date: Mon, 31 Aug 2020 22:39:42 +0200 Subject: [PATCH] Fix out-of-bounds access (#19) --- lsp-ivy.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lsp-ivy.el b/lsp-ivy.el index 5cc2ef0..a70a2f8 100644 --- a/lsp-ivy.el +++ b/lsp-ivy.el @@ -60,7 +60,7 @@ :type '(repeat integer)) (defcustom lsp-ivy-symbol-kind-to-face - [(" " . nil) ;; Unknown - 0 + [(" " . nil) ;; Unknown - 0 ("File" . font-lock-builtin-face) ;; File - 1 ("Modu" . font-lock-keyword-face) ;; Module - 2 ("Nmsp" . font-lock-keyword-face) ;; Namespace - 3 @@ -137,7 +137,8 @@ ((&SymbolInformation :name :kind :container-name? :location (&Location :uri)) project-root) "Convert the match returned by `lsp-mode` into a candidate string." - (let* ((type (elt lsp-ivy-symbol-kind-to-face kind)) + (let* ((sanitized-kind (if (< kind (length lsp-ivy-symbol-kind-to-face)) kind 0)) + (type (elt lsp-ivy-symbol-kind-to-face sanitized-kind)) (typestr (if lsp-ivy-show-symbol-kind (propertize (format "[%s] " (car type)) 'face (cdr type)) ""))