From 8a5ca84612f34eeb7a4cb12b32802f247a140d69 Mon Sep 17 00:00:00 2001
From: Jochen Henneberg <jochen@centricular.com>
Date: Tue, 28 Jan 2025 11:43:50 +0100
Subject: [PATCH] validate: Get proper error message on diff error instead of
 assert

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8376>
---
 .../validate/gst/validate/flow/gstvalidateflow.c           | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/subprojects/gst-devtools/validate/gst/validate/flow/gstvalidateflow.c b/subprojects/gst-devtools/validate/gst/validate/flow/gstvalidateflow.c
index f63253b038..92bed68701 100644
--- a/subprojects/gst-devtools/validate/gst/validate/flow/gstvalidateflow.c
+++ b/subprojects/gst-devtools/validate/gst/validate/flow/gstvalidateflow.c
@@ -461,8 +461,11 @@ run_diff (const gchar * expected_file, const gchar * actual_file)
       "--", expected_file, actual_file, NULL);
   gchar *stdout_text = NULL;
 
-  g_subprocess_communicate_utf8 (process, NULL, NULL, &stdout_text, NULL,
-      &error);
+  if (!error) {
+    g_subprocess_communicate_utf8 (process, NULL, NULL, &stdout_text, NULL,
+        &error);
+  }
+
   if (!error) {
     gboolean colored = gst_validate_has_colored_output ();
     GSubprocess *process2;