Prevent calling g_output_stream_write with NULL stream