[Xfce4-commits] <postler:master> Manually handle error condition for DBUS array methods

Christian Dywan noreply at xfce.org
Sat Jul 9 16:20:01 CEST 2011


Updating branch refs/heads/master
         to 72340d598fd22312f607d2a15ae311e9aff5fc42 (commit)
       from ee6b41eaf664bf7f300e14d72f6768f3908ac100 (commit)

commit 72340d598fd22312f607d2a15ae311e9aff5fc42
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Jul 9 15:26:17 2011 +0200

    Manually handle error condition for DBUS array methods
    
    Vala won't automatically return the right array type.

 postler/postler-client.vala  |    2 ++
 postler/postler-service.vala |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/postler/postler-client.vala b/postler/postler-client.vala
index 8b75e96..59854d3 100644
--- a/postler/postler-client.vala
+++ b/postler/postler-client.vala
@@ -61,6 +61,8 @@ namespace Postler {
         }
 
         public async int64[] unread_messages (string uri) throws GLib.Error {
+            int64[] new_messages = { 0, 0 };
+            return_val_if_fail (uri != null, new_messages);
             return yield client.unread_messages (uri);
         }
 
diff --git a/postler/postler-service.vala b/postler/postler-service.vala
index 91331a3..8c3cbcc 100644
--- a/postler/postler-service.vala
+++ b/postler/postler-service.vala
@@ -389,6 +389,8 @@ namespace Postler {
         }
 
         public int64[] unread_messages (string uri) throws GLib.Error {
+            int64[] new_messages = { 0, 0 };
+            return_val_if_fail (index != null, new_messages);
              return index.unread_messages (uri);
         }
 
@@ -411,6 +413,8 @@ namespace Postler {
         public signal void got_message (GLib.HashTable<string,Variant> message, int64 position);
 
         public string[] get_messages (string uri) throws GLib.Error {
+            string[] ids = {};
+            return_val_if_fail (index != null, ids);
             return index.get_messages (uri);
         }
 



More information about the Xfce4-commits mailing list