[empathy] adium themes: crash less hard when Template.html is missing
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] adium themes: crash less hard when Template.html is missing
- Date: Fri, 14 Oct 2011 17:23:32 +0000 (UTC)
commit 68fc48674fb98a3a8fa5cdb48fd12742558ad494
Author: Will Thompson <will thompson collabora co uk>
Date: Fri Oct 14 16:22:54 2011 +0100
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.
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 9c23d35..42c0914 100644
--- a/libempathy-gtk/empathy-theme-adium.c
+++ b/libempathy-gtk/empathy-theme-adium.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]