Bugfix for EUDCB-BBDB queries.
authorSergio Durigan Junior <sergiodj@riseup.net>
Tue, 2 Oct 2012 05:10:16 +0000 (13:10 +0800)
committerChong Yidong <cyd@gnu.org>
Tue, 2 Oct 2012 05:10:16 +0000 (13:10 +0800)
* net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result): Fix
querying BBDB for entries without a last name.

Fixes: debbugs:11580

lisp/ChangeLog
lisp/net/eudcb-bbdb.el

index 1e674c1..4650aa3 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-02  Sergio Durigan Junior  <sergiodj@riseup.net>
+
+       * net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result): Fix
+       querying BBDB for entries without a last name (Bug#11580).
+
 2012-10-02  Chong Yidong  <cyd@gnu.org>
 
        * emacs-lisp/eieio.el: Restore Version header.
index 9d160fe..42b6188 100644 (file)
@@ -166,18 +166,18 @@ The record is filtered according to `eudc-bbdb-current-return-attributes'"
                                  (symbol-name attr)))
                         'record))))
        (t
-       (setq val "Unknown BBDB attribute")))
-      (if val
-       (cond
-        ((memq attr '(phones addresses))
-         (setq eudc-rec (append val eudc-rec)))
-        ((and (listp val)
-         (= 1 (length val)))
-         (setq eudc-rec (cons (cons attr (car val)) eudc-rec)))
-        ((> (length val) 0)
-         (setq eudc-rec (cons (cons attr val) eudc-rec)))
-        (t
-         (error "Unexpected attribute value")))))
+       (error "Unknown BBDB attribute")))
+      (cond
+       ((or (not val) (equal val ""))) ; do nothing
+       ((memq attr '(phones addresses))
+       (setq eudc-rec (append val eudc-rec)))
+       ((and (listp val)
+            (= 1 (length val)))
+       (setq eudc-rec (cons (cons attr (car val)) eudc-rec)))
+       ((> (length val) 0)
+       (setq eudc-rec (cons (cons attr val) eudc-rec)))
+       (t
+       (error "Unexpected attribute value"))))
     (nreverse eudc-rec)))