]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
only write when it make sense
authorSeven Du <dujinfang@gmail.com>
Wed, 25 Sep 2013 12:02:39 +0000 (20:02 +0800)
committerSeven Du <dujinfang@gmail.com>
Wed, 25 Sep 2013 18:16:31 +0000 (02:16 +0800)
src/switch_core_io.c

index 2b3c3b6d6611c08ed85a2ae2f58d6b4a82d187bf..aad6192eceb3da53b63c91fc54ca26d5985a03a8 100644 (file)
@@ -773,7 +773,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                        switch_buffer_create_dynamic(&session->raw_read_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, bytes * SWITCH_BUFFER_START_FRAMES, 0);
                                }
 
-                               if (!switch_buffer_write(session->raw_read_buffer, read_frame->data, read_frame->datalen)) {
+                               if (read_frame->datalen && (!switch_buffer_write(session->raw_read_buffer, read_frame->data, read_frame->datalen))) {
                                        status = SWITCH_STATUS_MEMERR;
                                        goto done;
                                }