Commit 53d47cab authored by Denis Charmet's avatar Denis Charmet Committed by Jean-Baptiste Kempf

MKV: Don't crash when loading a directory with no uid MKV files

Close #6575
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 4599e6a4491fce5a8ae3377e601ab3aa258d33e4)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent b56a6d0f
...@@ -554,7 +554,7 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS ...@@ -554,7 +554,7 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
break; break;
} }
} }
if ( b_keep_segment ) if ( b_keep_segment || !p_segment1->p_segment_uid )
{ {
b_keep_stream = true; b_keep_stream = true;
p_stream1->segments.push_back( p_segment1 ); p_stream1->segments.push_back( p_segment1 );
...@@ -746,7 +746,7 @@ matroska_segment_c *demux_sys_t::FindSegment( const EbmlBinary & uid ) const ...@@ -746,7 +746,7 @@ matroska_segment_c *demux_sys_t::FindSegment( const EbmlBinary & uid ) const
{ {
for (size_t i=0; i<opened_segments.size(); i++) for (size_t i=0; i<opened_segments.size(); i++)
{ {
if ( *opened_segments[i]->p_segment_uid == uid ) if ( opened_segments[i]->p_segment_uid && *opened_segments[i]->p_segment_uid == uid )
return opened_segments[i]; return opened_segments[i];
} }
return NULL; return NULL;
......
...@@ -31,7 +31,8 @@ matroska_segment_c * getSegmentbyUID( KaxSegmentUID * p_uid, std::vector<matrosk ...@@ -31,7 +31,8 @@ matroska_segment_c * getSegmentbyUID( KaxSegmentUID * p_uid, std::vector<matrosk
{ {
for( size_t i = 0; i < (*segments).size(); i++ ) for( size_t i = 0; i < (*segments).size(); i++ )
{ {
if( *p_uid == *((*segments)[i]->p_segment_uid) ) if( (*segments)[i]->p_segment_uid &&
*p_uid == *((*segments)[i]->p_segment_uid) )
return (*segments)[i]; return (*segments)[i];
} }
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment