[Xfce4-commits] <postler:master> Setup composer properly if no arguments are given

Christian Dywan noreply at xfce.org
Sun Mar 6 22:06:03 CET 2011


Updating branch refs/heads/master
         to cf589a075bc8d7fdce94880c07f0892246e39a88 (commit)
       from cd9946f7d33c030cf8be905250d5d7bff5d7202d (commit)

commit cf589a075bc8d7fdce94880c07f0892246e39a88
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Mar 6 21:30:09 2011 +0100

    Setup composer properly if no arguments are given
    
    Fixes: https://bugs.launchpad.net/postler/+bug/730175

 postler/postler-reader.vala |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/postler/postler-reader.vala b/postler/postler-reader.vala
index bd7038b..7619557 100644
--- a/postler/postler-reader.vala
+++ b/postler/postler-reader.vala
@@ -120,15 +120,15 @@ public class Postler.Reader {
                 }
             }
             else if (module == "compose") {
-                instance = new Postler.Composer ();
-                if (filenames != null && filenames[0] != null) {
-                    Postler.Composer composer = (Postler.Composer)instance;
-                    string mailto;
-                    /* mailto: may or may not be stripped by the calling app */
-                    if (filenames[0].has_prefix ("mailto:"))
-                        mailto = filenames[0].substring (7, -1);
-                    else
-                        mailto = filenames[0];
+                Postler.Composer composer = new Postler.Composer ();
+                instance = composer;
+                string mailto = "";
+                if (filenames != null && filenames[0] != null)
+                    mailto = filenames[0];
+                /* mailto: may or may not be stripped by the calling app */
+                if (mailto.has_prefix ("mailto:"))
+                    mailto = mailto.substring (7, -1);
+
                     string[] fields = Soup.URI.decode (mailto).split_set ("?&");
                     foreach (var field in fields) {
                         string[] pieces = field.split ("=");
@@ -141,14 +141,15 @@ public class Postler.Reader {
                             GLib.warning (_("Invalid field \"%s\" was ignored."),
                                           pieces[1] != null ? pieces[0] : field);
                     }
-                    if (filenames[1] != null) {
+
+                    if (filenames != null && filenames[1] != null) {
                         composer.prepare_reply (filenames[1],
                             composer.subject.has_prefix ("Re: ")
                          || composer.subject.has_prefix ("Fw: "));
                     } else {
                         composer.prepare_reply ();
                     }
-                }
+
                 instance.destroy.connect (Gtk.main_quit);
                 instance.show ();
                 Gtk.main ();



More information about the Xfce4-commits mailing list