diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-10-14 23:22:54 +0800 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-10-14 23:57:49 +0800 |
commit | e623416a51aca9f813208a0691585d6fb0dbbb1b (patch) | |
tree | 43c0c9a0996a5ba823c08c5d3b0ec7eb9a5fcdbb | |
parent | 0e053c39298d88afa1645c0d95a8aa43b662cc38 (diff) | |
download | gsoc2013-empathy-e623416a51aca9f813208a0691585d6fb0dbbb1b.tar gsoc2013-empathy-e623416a51aca9f813208a0691585d6fb0dbbb1b.tar.gz gsoc2013-empathy-e623416a51aca9f813208a0691585d6fb0dbbb1b.tar.bz2 gsoc2013-empathy-e623416a51aca9f813208a0691585d6fb0dbbb1b.tar.lz gsoc2013-empathy-e623416a51aca9f813208a0691585d6fb0dbbb1b.tar.xz gsoc2013-empathy-e623416a51aca9f813208a0691585d6fb0dbbb1b.tar.zst gsoc2013-empathy-e623416a51aca9f813208a0691585d6fb0dbbb1b.zip |
adium themes: crash less hard when Template.html is missing
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.
-rw-r--r-- | libempathy-gtk/empathy-theme-adium.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index fde9d9295..820cd587e 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -1918,8 +1918,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); } |