]> git.0d.be Git - empathy.git/commitdiff
adium themes: crash less hard when Template.html is missing
authorWill Thompson <will.thompson@collabora.co.uk>
Fri, 14 Oct 2011 15:22:54 +0000 (16:22 +0100)
committerWill Thompson <will.thompson@collabora.co.uk>
Fri, 14 Oct 2011 17:22:03 +0000 (18:22 +0100)
If Template.html is missing, then you haven't installed Empathy properly
(or set EMPATHY_SRCDIR or whatever in my case). But previously we would
just crash later down this function when passing template_html to
string_with_format() without checking if it's NULL. This patch makes
it fail a little less inscrutably.

libempathy-gtk/empathy-theme-adium.c

index 9c23d35170804638d4cba5dcadf59ddbe2e637e4..42c0914c83c94f66582b1ea1558e2e84a156caf6 100644 (file)
@@ -1941,8 +1941,16 @@ empathy_adium_data_new_with_info (const gchar *path, GHashTable *info)
        /* template -> empathy's template */
        data->custom_template = (template_html != NULL);
        if (template_html == NULL) {
+               GError *error = NULL;
+
                tmp = empathy_file_lookup ("Template.html", "data");
-               g_file_get_contents (tmp, &template_html, NULL, NULL);
+
+               if (!g_file_get_contents (tmp, &template_html, NULL, &error)) {
+                       g_warning ("couldn't load Empathy's default theme "
+                               "template: %s", error->message);
+                       g_return_val_if_reached (data);
+               }
+
                g_free (tmp);
        }