From: Michael Albinus Date: Sat, 3 Jan 2009 14:55:10 +0000 (+0000) Subject: * net/dbus.el (dbus-string-to-byte-array): Handle empty array. X-Git-Tag: emacs-pretest-23.0.90~734 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d665fff055b1da90e5b7636e145b55a2cd0d68da;p=emacs.git * net/dbus.el (dbus-string-to-byte-array): Handle empty array. --- diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 13c2d39f6dd..ee20db9ac34 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -1,6 +1,6 @@ ;;; dbus.el --- Elisp bindings for D-Bus. -;; Copyright (C) 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. ;; Author: Michael Albinus ;; Keywords: comm, hardware @@ -247,9 +247,11 @@ usage: (dbus-name-owner-changed-handler service old-owner new-owner)" (defun dbus-string-to-byte-array (string) "Transforms STRING to list (:array :byte c1 :byte c2 ...). STRING shall be UTF8 coded." - (let (result) - (dolist (elt (string-to-list string) (append '(:array) result)) - (setq result (append result (list :byte elt)))))) + (if (zerop (length string)) + '(:array :signature "y") + (let (result) + (dolist (elt (string-to-list string) (append '(:array) result)) + (setq result (append result (list :byte elt))))))) (defun dbus-byte-array-to-string (byte-array) "Transforms BYTE-ARRAY into UTF8 coded string.