]> git.sesse.net Git - vlc/commitdiff
input: stream_memory: handle skip reads
authorFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 29 Sep 2014 18:06:05 +0000 (20:06 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 29 Sep 2014 18:07:44 +0000 (20:07 +0200)
Regular streams skip if p_read is NULL.

src/input/stream_memory.c

index 491ab02f01988b0ae797a3891b8f3a61ff5de2dc..25caa2e15d11c88641df2d26d45d61f9ca1679f8 100644 (file)
@@ -157,7 +157,8 @@ static int Read( stream_t *s, void *p_read, unsigned int i_read )
 {
     stream_sys_t *p_sys = s->p_sys;
     int i_res = __MIN( i_read, p_sys->i_size - p_sys->i_pos );
-    memcpy( p_read, p_sys->p_buffer + p_sys->i_pos, i_res );
+    if ( p_read )
+        memcpy( p_read, p_sys->p_buffer + p_sys->i_pos, i_res );
     p_sys->i_pos += i_res;
     return i_res;
 }