[gnome-builder/wip/chergert/debugger: 82/89] mi2: check for NULL return values
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/debugger: 82/89] mi2: check for NULL return values
- Date: Tue, 9 May 2017 01:12:30 +0000 (UTC)
commit ed01aa3533ea15ca2996bfdb4e1d0620e71fdc48
Author: Christian Hergert <chergert redhat com>
Date: Sat Apr 8 19:37:23 2017 -0700
mi2: check for NULL return values
contrib/mi2/mi2-console-message.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/contrib/mi2/mi2-console-message.c b/contrib/mi2/mi2-console-message.c
index 9e84fc7..71dc3bf 100644
--- a/contrib/mi2/mi2-console-message.c
+++ b/contrib/mi2/mi2-console-message.c
@@ -44,14 +44,20 @@ mi2_console_message_serialize (Mi2Message *message)
{
Mi2ConsoleMessage *self = (Mi2ConsoleMessage *)message;
g_autofree gchar *escaped = NULL;
- g_autofree gchar *str = NULL;
g_assert (MI2_IS_CONSOLE_MESSAGE (message));
escaped = g_strescape (self->message ? self->message : "", "");
- str = g_strdup_printf ("~\"%s\"\n", escaped);
- return g_bytes_new_take (g_steal_pointer (&str), strlen (str));
+ if (escaped != NULL)
+ {
+ g_autofree gchar *str = g_strdup_printf ("~\"%s\"\n", escaped);
+
+ if (str != NULL)
+ return g_bytes_new_take (g_steal_pointer (&str), strlen (str));
+ }
+
+ return NULL;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]