changeset 100855:4502d2277f2c

* net/dbus.el (dbus-string-to-byte-array): Handle empty array.
author Michael Albinus <michael.albinus@gmx.de>
date Sat, 03 Jan 2009 14:55:10 +0000
parents 63cba20d8dca
children 49bc8bb7a597
files lisp/net/dbus.el
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/dbus.el	Sat Jan 03 14:54:52 2009 +0000
+++ b/lisp/net/dbus.el	Sat Jan 03 14:55:10 2009 +0000
@@ -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 <michael.albinus@gmx.de>
 ;; Keywords: comm, hardware
@@ -247,9 +247,11 @@
 (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.