[vlc-devel] [PATCH 6/6] mkv: never set p_current_vsegment to NULL
Steve Lhomme
robux4 at videolabs.io
Thu Mar 17 12:16:14 CET 2016
if we don't have usable segments, p_current_vsegment will never be used
---
modules/demux/mkv/demux.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index b4424f0..591c69d 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -654,7 +654,10 @@ bool demux_sys_t::PreloadLinked()
size_t i, j, ij = 0;
virtual_segment_c *p_vseg;
- p_current_vsegment = opened_segments.size() ? new (std::nothrow) virtual_segment_c( *(opened_segments[0]), opened_segments ) : NULL;
+ if ( unlikely(opened_segments.size() == 0) )
+ return false;
+
+ p_current_vsegment = new (std::nothrow) virtual_segment_c( *(opened_segments[0]), opened_segments );
if ( !p_current_vsegment )
return false;
@@ -776,7 +779,7 @@ bool demux_sys_t::PreparePlayback( virtual_segment_c *p_new_vsegment )
{
if ( p_new_vsegment != NULL && p_new_vsegment != p_current_vsegment )
{
- if ( p_current_vsegment != NULL && p_current_vsegment->CurrentSegment() != NULL )
+ if ( p_current_vsegment->CurrentSegment() != NULL )
p_current_vsegment->CurrentSegment()->UnSelect();
p_current_vsegment = p_new_vsegment;
--
2.7.2.windows.1
More information about the vlc-devel
mailing list