srt: assert instead of segfault when passing no error to ERROR_TO_WARNING

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4524>
This commit is contained in:
Guillaume Desmottes 2023-05-02 11:34:36 +02:00 committed by GStreamer Marge Bot
parent 3a5510f61c
commit 5a7ed3c89d

View file

@ -39,7 +39,9 @@ GST_DEBUG_CATEGORY_EXTERN (gst_debug_srtobject);
#define ERROR_TO_WARNING(srtobject, error, suffix) \
G_STMT_START { \
gchar *text = g_strdup_printf ("%s%s", (error)->message, (suffix)); \
gchar *text; \
g_assert (error); \
text = g_strdup_printf ("%s%s", (error)->message, (suffix)); \
GST_WARNING_OBJECT ((srtobject)->element, "warning: %s", text); \
gst_element_message_full ((srtobject)->element, GST_MESSAGE_WARNING, \
(error)->domain, (error)->code, text, NULL, __FILE__, GST_FUNCTION, \