From 946c798dfc19047ae3cebe63d00db84ec525a9bc Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 21 Dec 2015 15:13:15 +0200 Subject: [PATCH] Handle empty list of candidates --- company.el | 2 +- test/core-tests.el | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/company.el b/company.el index 8d416de92..498920afb 100644 --- a/company.el +++ b/company.el @@ -1239,7 +1239,7 @@ can retrieve meta-data for them." (push anno2 annos) (push str res) ; Maintain ordering. (setq str str2))))) - (push str res) + (when str (push str res)) (nreverse res))) (defun company--transform-candidates (candidates) diff --git a/test/core-tests.el b/test/core-tests.el index dcadfd3ab..46d17093b 100644 --- a/test/core-tests.el +++ b/test/core-tests.el @@ -399,6 +399,9 @@ (and (ert-equal-including-properties (car list1) (car list2)) (ct-equal-including-properties (cdr list1) (cdr list2))))) +(ert-deftest company-strips-duplicates-returns-nil () + (should (null (company--preprocess-candidates nil)))) + (ert-deftest company-strips-duplicates-within-groups () (let* ((kvs '(("a" . "b") ("a" . nil) -- 2.39.2