[vlc-devel] [PATCH 38/48] hls: Don't crash when download thread is cancelled.

Hugo Beauzée-Luyssen beauze.h at gmail.com
Mon Jan 9 16:16:47 CET 2012


---
 modules/stream_filter/httplive.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 0cca67f..14bb159 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -2246,6 +2246,12 @@ static int Peek(stream_t *s, const uint8_t **pp_peek, unsigned int i_peek)
         msg_Warn(s, "Peek() no segment --> end of the stream");
         return 0; /* eof? */
     }
+    //If the thread is cancelled, GetSegment may return a segment with NULL data
+    if ( segment->data == NULL )
+    {
+        msg_Warn( s, "Got a segment without data." );
+        return 0;
+    }
 
     vlc_mutex_lock(&segment->lock);
 
-- 
1.7.8.3




More information about the vlc-devel mailing list