Commit 4ff2a9a2 authored by Steve Lhomme's avatar Steve Lhomme

* prevent crashes when a stream is not opened correctly

parent cb2ad9ec
...@@ -123,6 +123,9 @@ static inline int stream_Control( stream_t *s, int i_query, ... ) ...@@ -123,6 +123,9 @@ static inline int stream_Control( stream_t *s, int i_query, ... )
va_list args; va_list args;
int i_result; int i_result;
if ( s == NULL )
return VLC_EGENERIC;
va_start( args, i_query ); va_start( args, i_query );
i_result = s->pf_control( s, i_query, args ); i_result = s->pf_control( s, i_query, args );
va_end( args ); va_end( args );
......
...@@ -1481,10 +1481,14 @@ static int Open( vlc_object_t * p_this ) ...@@ -1481,10 +1481,14 @@ static int Open( vlc_object_t * p_this )
#endif #endif
{ {
// test wether this file belongs to our family // test wether this file belongs to our family
vlc_stream_io_callback *p_file_io = new vlc_stream_io_callback( stream_UrlNew( p_demux, s_filename.c_str()), VLC_TRUE ); stream_t *p_file_stream = stream_UrlNew( p_demux, s_filename.c_str());
if ( p_file_stream != NULL )
{
vlc_stream_io_callback *p_file_io = new vlc_stream_io_callback( p_file_stream, VLC_TRUE );
EbmlStream *p_estream = new EbmlStream(*p_file_io); EbmlStream *p_estream = new EbmlStream(*p_file_io);
p_stream = p_sys->AnalyseAllSegmentsFound( p_estream ); p_stream = p_sys->AnalyseAllSegmentsFound( p_estream );
if ( p_stream == NULL ) if ( p_stream == NULL )
{ {
msg_Dbg( p_demux, "the file '%s' will not be used", s_filename.c_str() ); msg_Dbg( p_demux, "the file '%s' will not be used", s_filename.c_str() );
...@@ -1498,6 +1502,11 @@ static int Open( vlc_object_t * p_this ) ...@@ -1498,6 +1502,11 @@ static int Open( vlc_object_t * p_this )
p_sys->streams.push_back( p_stream ); p_sys->streams.push_back( p_stream );
} }
} }
else
{
msg_Dbg( p_demux, "the file '%s' cannot be opened", s_filename.c_str() );
}
}
} }
} }
closedir( p_src_dir ); closedir( p_src_dir );
...@@ -3324,6 +3333,8 @@ size_t vlc_stream_io_callback::write( const void *p_buffer, size_t i_size ) ...@@ -3324,6 +3333,8 @@ size_t vlc_stream_io_callback::write( const void *p_buffer, size_t i_size )
} }
uint64 vlc_stream_io_callback::getFilePointer( void ) uint64 vlc_stream_io_callback::getFilePointer( void )
{ {
if ( s == NULL )
return 0;
return stream_Tell( s ); return stream_Tell( s );
} }
void vlc_stream_io_callback::close( void ) void vlc_stream_io_callback::close( void )
......
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