[Xfce4-commits] <midori:master> Check if extension_init returns NULL and handle it

Christian Dywan noreply at xfce.org
Wed Jun 30 23:12:01 CEST 2010


Updating branch refs/heads/master
         to b0191b69b08a7c7436bb46cb6a2f6c14f9b084e5 (commit)
       from a04bf24b5ef4efc2df0a89b856d4d0e66b19785d (commit)

commit b0191b69b08a7c7436bb46cb6a2f6c14f9b084e5
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Jun 30 23:09:21 2010 +0200

    Check if extension_init returns NULL and handle it
    
    In the case where an extension ends up existing multiple
    times, it will fail to create an instance. We would
    rather see it in the list than crash.

 midori/main.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/midori/main.c b/midori/main.c
index ab7de93..0b40b41 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -1109,13 +1109,17 @@ midori_load_extensions (gpointer data)
                                                (gpointer) &extension_init))
                 {
                     extension = extension_init ();
-                    /* Signal that we want the extension to load and save */
-                    g_object_set_data_full (G_OBJECT (extension), "filename",
-                                            g_strdup (filename), g_free);
-                    if (midori_extension_is_prepared (extension))
-                        midori_extension_get_config_dir (extension);
+                    if (extension != NULL)
+                    {
+                        /* Signal that we want the extension to load and save */
+                        g_object_set_data_full (G_OBJECT (extension), "filename",
+                                                g_strdup (filename), g_free);
+                        if (midori_extension_is_prepared (extension))
+                            midori_extension_get_config_dir (extension);
+                    }
                 }
-                else
+
+                if (!extension)
                 {
                     extension = g_object_new (MIDORI_TYPE_EXTENSION,
                                               "name", filename,



More information about the Xfce4-commits mailing list