[gtk/wip/otte/center-center-center: 2/3] reftests: Don't crash if no node




commit e8bc5dc4ca28b90423ed8a1389f5a5958c0056e6
Author: Benjamin Otte <otte redhat com>
Date:   Thu Oct 21 03:06:56 2021 +0200

    reftests: Don't crash if no node
    
    If we have no node, don't crash when trying to save the node file.
    
    Instead, write an empty file.

 testsuite/reftests/gtk-reftest.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c
index 2bf3fcc5f8..b3f9774c73 100644
--- a/testsuite/reftests/gtk-reftest.c
+++ b/testsuite/reftests/gtk-reftest.c
@@ -311,7 +311,10 @@ save_node (GskRenderNode *node,
     }
 
   g_test_message ("Storing test result node at %s", filename);
-  bytes = gsk_render_node_serialize (node);
+  if (node)
+    bytes = gsk_render_node_serialize (node);
+  else
+    bytes = g_bytes_new ("", 0);
   ret = g_file_set_contents (filename,
                              g_bytes_get_data (bytes, NULL),
                              g_bytes_get_size (bytes),


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