[Xfce4-commits] <postler:master> Add extra return_if_fail to Postler.Messages

Christian Dywan noreply at xfce.org
Fri Dec 31 00:52:01 CET 2010


Updating branch refs/heads/master
         to 731a9fed389f0b170ee6a0b023d97b0b175cf136 (commit)
       from 95d29fd49570d127700bb198116dcd82f0ff4c67 (commit)

commit 731a9fed389f0b170ee6a0b023d97b0b175cf136
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Dec 30 15:41:18 2010 +0100

    Add extra return_if_fail to Postler.Messages
    
    Vala's automatic argument verifications are limited, the extra
    checks make it a tad easier to locate wrong values.

 postler/postler-messages.vala |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index 94e3199..d5e24ec 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -379,7 +379,10 @@ public class Postler.Messages : Gtk.TreeView {
         }
     }
 
-    internal static string parse_encoded (string encoded, out string charset) {
+    internal static string parse_encoded (string? encoded, out string charset) {
+        charset = null;
+        return_val_if_fail (encoded != null, null);
+
         /* format "=?charset?encoding?encoded?=",
            if in doubt, bail out and take the raw data */
         /* We mask "?q?=" as "\nq\n=" here because ?= is our delimiter */
@@ -782,6 +785,7 @@ public class Postler.Messages : Gtk.TreeView {
     }
 
     void toggle_message_flag (Gtk.TreeIter sort_iter, ref string location, char flag) {
+        return_if_fail (location != null);
         string new_location = toggle_flag (location, flag);
         if (FileUtils.rename (location, new_location) == 0) {
             location = new_location;
@@ -863,6 +867,7 @@ public class Postler.Messages : Gtk.TreeView {
     }
 
     void mark_message_read (Gtk.TreeIter sort_iter, ref string location) {
+        return_if_fail (location != null);
         string bare_filename;
         if (!flags_from_filename (location, out bare_filename).contains ("S"))
             toggle_message_flag (sort_iter, ref location, 'S');



More information about the Xfce4-commits mailing list