]> www.fi.muni.cz Git - evince.git/commitdiff
Fix a crash when there isn't a default application to open an attachment
authorCarlos Garcia Campos <carlosgc@gnome.org>
Tue, 4 Apr 2006 16:52:48 +0000 (16:52 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Tue, 4 Apr 2006 16:52:48 +0000 (16:52 +0000)
2006-04-03  Carlos Garcia Campos  <carlosgc@gnome.org>
* backend/ev-attachment.c:
Fix a crash when there isn't a default application to open an
attachment

ChangeLog
backend/ev-attachment.c

index 9198e594216c10e63f752ca41b1658bf05d6a9a2..259bf04e6fb7b1555d3be4d1da2d3769976fb0a6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-04-03  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * backend/ev-attachment.c: 
+
+       Fix a crash when there isn't a default application to open an
+       attachment
+
 2006-04-03  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * backend/ev-attachment.[ch]:
index 9d5aaffbe398d9b150d7f079a0a674df8c835a4e..f0002f37230b362c22f835fe566351e23853895e 100644 (file)
@@ -364,12 +364,24 @@ ev_attachment_open (EvAttachment *attachment,
                    GError      **error)
 {
 
-       gboolean retval = FALSE;
+       gboolean                 retval = FALSE;
+       GnomeVFSMimeApplication *default_app = NULL;
 
        if (!attachment->priv->app)
-               attachment->priv->app =
-                       gnome_vfs_mime_get_default_application (attachment->priv->mime_type);
+               default_app = gnome_vfs_mime_get_default_application (attachment->priv->mime_type);
 
+       if (!default_app) {
+               g_set_error (error,
+                            EV_ATTACHMENT_ERROR,
+                            0,
+                            _("Couldn't open attachment '%s'"),
+                            attachment->priv->name);
+               
+               return FALSE;
+       }
+
+       attachment->priv->app = default_app;
+       
        if (attachment->priv->tmp_uri &&
            g_file_test (attachment->priv->tmp_uri, G_FILE_TEST_EXISTS)) {
                retval = ev_attachment_launch_app (attachment, error);