OSDN Git Service

LinGui: fix crash on empty buffer from stderr
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 16 Jul 2009 17:29:17 +0000 (17:29 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 16 Jul 2009 17:29:17 +0000 (17:29 +0000)
somehow, i'm getting a buffer that has nothing but a '\0' char
g_io_channel_write_chars gets really upset about the nil character and crashes

git-svn-id: svn://localhost/HandBrake/trunk@2697 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/callbacks.c

index 54a5d0c..bccc030 100644 (file)
@@ -2628,7 +2628,7 @@ ghb_log_cb(GIOChannel *source, GIOCondition cond, gpointer data)
        signal_user_data_t *ud = (signal_user_data_t*)data;
 
        status = g_io_channel_read_line (source, &text, &length, NULL, &gerror);
-       if (text != NULL)
+       if (text != NULL && length > 0 && text[length-1] != 0)
        {
                GdkWindow *window;
                gint width, height;