[gnome-builder/wip/chergert/debugger: 157/163] mi2: handle NULL from serializer



commit 7050847ddd9cc288902acd10a34e06f6aa276b2c
Author: Christian Hergert <chergert redhat com>
Date:   Sat Apr 8 19:38:52 2017 -0700

    mi2: handle NULL from serializer

 contrib/mi2/mi2-output-stream.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/contrib/mi2/mi2-output-stream.c b/contrib/mi2/mi2-output-stream.c
index 8deb6b1..dfc6fb6 100644
--- a/contrib/mi2/mi2-output-stream.c
+++ b/contrib/mi2/mi2-output-stream.c
@@ -77,6 +77,15 @@ mi2_output_stream_write_message_async (Mi2OutputStream     *self,
 
   bytes = mi2_message_serialize (message);
 
+  if (bytes == NULL)
+    {
+      g_task_return_new_error (task,
+                               G_IO_ERROR,
+                               G_IO_ERROR_INVALID_DATA,
+                               "message failed to serialize to bytes");
+      return;
+    }
+
   g_output_stream_write_bytes_async (G_OUTPUT_STREAM (self),
                                      bytes,
                                      G_PRIORITY_LOW,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]