]> spindle.queued.net Git - midori/commitdiff
Check if extension_init returns NULL and handle it
authorChristian Dywan <christian@twotoasts.de>
Wed, 30 Jun 2010 21:09:21 +0000 (23:09 +0200)
committerChristian Dywan <christian@twotoasts.de>
Wed, 30 Jun 2010 21:09:21 +0000 (23:09 +0200)
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

index ab7de931e39cfd62ed500a733cbbdf757685cc10..0b40b412899566b83ad1c611a132eaefca9e0ed4 100644 (file)
@@ -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,