commit ee56c6bde9f90fd489bf62b78cdbf1c2d7dfc7bd
parent 6b071da1e68bc5b1389bc82f9cd8b464701dc6a3
Author: Michael Rasmussen <mir@datanom.net>
Date: Fri, 5 Mar 2021 09:25:53 +0100
Merge branch 'master' into oauth2
Diffstat:
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/common/stringtable.c b/src/common/stringtable.c
@@ -64,7 +64,10 @@ StringTable *string_table_new(void)
strtable = g_new0(StringTable, 1);
cm_return_val_if_fail(strtable != NULL, NULL);
strtable->hash_table = g_hash_table_new(g_str_hash, g_str_equal);
- cm_return_val_if_fail(strtable->hash_table, NULL);
+ if (strtable->hash_table == NULL) {
+ g_free(strtable);
+ return NULL;
+ }
return strtable;
}
diff --git a/src/gtk/gtkutils.c b/src/gtk/gtkutils.c
@@ -1089,6 +1089,10 @@ GtkWidget *xface_get_from_header(const gchar *o_xface)
static gchar *xpm_xface[XPM_XFACE_HEIGHT];
static gboolean xpm_xface_init = TRUE;
gchar xface[2048];
+
+ if (o_xface == NULL)
+ return NULL;
+
strncpy(xface, o_xface, sizeof(xface) - 1);
xface[sizeof(xface) - 1] = '\0';
diff --git a/src/prefs_customheader.c b/src/prefs_customheader.c
@@ -908,7 +908,7 @@ static gboolean prefs_custom_header_selected(GtkTreeSelection *selector,
ENTRY_SET_TEXT(customhdr.hdr_entry, ch->name);
ENTRY_SET_TEXT(customhdr.val_entry, ch->value);
- if (!g_strcmp0("Face",ch->name)) {
+ if (!g_strcmp0("Face",ch->name) && ch->value != NULL) {
preview = GTK_IMAGE(face_get_from_header (ch->value));
pixbuf = gtk_image_get_pixbuf(preview);
gtk_image_set_from_pixbuf (GTK_IMAGE(customhdr.preview), pixbuf);
@@ -916,7 +916,7 @@ static gboolean prefs_custom_header_selected(GtkTreeSelection *selector,
g_object_ref_sink (G_OBJECT(preview));
}
#if HAVE_LIBCOMPFACE
-else if (!g_strcmp0("X-Face", ch->name)) {
+ else if (!g_strcmp0("X-Face", ch->name) && ch->value != NULL) {
preview = GTK_IMAGE(xface_get_from_header(ch->value));
pixbuf = gtk_image_get_pixbuf(preview);
gtk_image_set_from_pixbuf (GTK_IMAGE(customhdr.preview), pixbuf);
@@ -924,7 +924,7 @@ else if (!g_strcmp0("X-Face", ch->name)) {
g_object_ref_sink (G_OBJECT(preview));
}
#endif
-else {
+ else {
gtk_widget_hide(customhdr.preview);
}
return TRUE;