From 18d497a03d58b694f5713be41dc8cdef705a0326 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Tue, 13 Oct 2009 14:11:46 +0800 Subject: [PATCH] Do not crash if append NULL string to IBusMessage. --- src/ibusenginedesc.c | 4 +--- src/ibusmessage.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ibusenginedesc.c b/src/ibusenginedesc.c index d5b43261..08f0622a 100644 --- a/src/ibusenginedesc.c +++ b/src/ibusenginedesc.c @@ -289,9 +289,7 @@ ibus_engine_desc_parse_xml_node (IBusEngineDesc *desc, #define PARSE_ENTRY(field_name, element_name) \ if (g_strcmp0 (sub_node->name, element_name) == 0) { \ - if (desc->field_name != NULL) { \ - g_free (desc->field_name); \ - } \ + g_free (desc->field_name); \ desc->field_name = g_strdup (sub_node->text); \ continue; \ } diff --git a/src/ibusmessage.c b/src/ibusmessage.c index efc05885..9be3f649 100644 --- a/src/ibusmessage.c +++ b/src/ibusmessage.c @@ -525,7 +525,7 @@ ibus_message_iter_append (IBusMessageIter *iter, case G_TYPE_STRING: { const gchar *v; - v = * (gchar **)value; + v = *(gchar **)value != NULL ? * (gchar **)value : ""; return dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &v); } case G_TYPE_INT64: -- 2.34.1