[vlc-commits] mkv: never set p_current_vsegment to NULL
Steve Lhomme
git at videolan.org
Thu Mar 17 16:58:27 CET 2016
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Thu Mar 17 12:16:14 2016 +0100| [017fa060888215a82213795344d33c331f6e8522] | committer: Jean-Baptiste Kempf
mkv: never set p_current_vsegment to NULL
if we don't have usable segments, p_current_vsegment will never be used
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=017fa060888215a82213795344d33c331f6e8522
---
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 6d83897..df51ba4 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;
@@ -772,7 +775,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;
More information about the vlc-commits
mailing list