From 15f2d610f0e57210e8e0567bb825526f025dea51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20P=C3=B6lsterl?= Date: Fri, 20 Jun 2008 16:54:28 +0000 Subject: gst/mpegtsparse/mpegtspacketizer.c: Fix problem when empty string is provided. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message from CVS: Patch by: Sebastian Pölsterl * gst/mpegtsparse/mpegtspacketizer.c: Fix problem when empty string is provided. --- gst/mpegtsparse/mpegtspacketizer.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'gst/mpegtsparse') diff --git a/gst/mpegtsparse/mpegtspacketizer.c b/gst/mpegtsparse/mpegtspacketizer.c index 3b108f99..99d04c72 100644 --- a/gst/mpegtsparse/mpegtspacketizer.c +++ b/gst/mpegtsparse/mpegtspacketizer.c @@ -2183,9 +2183,13 @@ convert_to_utf8 (const gchar * text, gint length, guint start, } } - new_text = - g_convert ((gchar *) sb->data, sb->len, "utf-8", encoding, NULL, NULL, - error); + if (sb->len > 0) { + new_text = + g_convert ((gchar *) sb->data, sb->len, "utf-8", encoding, NULL, NULL, + error); + } else { + new_text = g_strdup (""); + } g_byte_array_free (sb, TRUE); @@ -2201,6 +2205,8 @@ get_encoding_and_convert (const gchar * text, guint length) guint start_text = 0; gboolean is_multibyte; + g_return_val_if_fail (text != NULL, NULL); + encoding = get_encoding (text, &start_text, &is_multibyte); if (encoding == NULL) { -- cgit v1.2.1