Commit f57a2f30 authored by Gildas Bazin's avatar Gildas Bazin

* modules/access/dshow/dshow.cpp: fixed crash when no dshow devices found.

parent f050c702
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dshow.c : DirectShow access module for vlc * dshow.c : DirectShow access module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: dshow.cpp,v 1.5 2003/08/27 07:31:26 gbazin Exp $ * $Id: dshow.cpp,v 1.6 2003/08/27 12:59:11 gbazin Exp $
* *
* Author: Gildas Bazin <gbazin@netcourrier.com> * Author: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -305,13 +305,14 @@ static int AccessOpen( vlc_object_t *p_this ) ...@@ -305,13 +305,14 @@ static int AccessOpen( vlc_object_t *p_this )
if( !p_sys->i_streams ) if( !p_sys->i_streams )
{ {
/* Release directshow objects */ /* Release directshow objects */
p_sys->p_control->Release(); if( p_sys->p_control ) p_sys->p_control->Release();
p_sys->p_graph->Release(); p_sys->p_graph->Release();
/* Uninitialize OLE/COM */ /* Uninitialize OLE/COM */
CoUninitialize(); CoUninitialize();
free( p_sys->p_header ); free( p_sys->p_header );
free( p_sys->pp_streams );
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -388,9 +389,12 @@ static int OpenDevice( input_thread_t *p_input, string devicename, ...@@ -388,9 +389,12 @@ static int OpenDevice( input_thread_t *p_input, string devicename,
access_sys_t *p_sys = p_input->p_access_data; access_sys_t *p_sys = p_input->p_access_data;
list<string> list_devices; list<string> list_devices;
/* Enumerate audio devices and display their names */ /* Enumerate devices and display their names */
FindCaptureDevice( (vlc_object_t *)p_input, NULL, &list_devices, b_audio ); FindCaptureDevice( (vlc_object_t *)p_input, NULL, &list_devices, b_audio );
if( !list_devices.size() )
return VLC_EGENERIC;
list<string>::iterator iter; list<string>::iterator iter;
for( iter = list_devices.begin(); iter != list_devices.end(); iter++ ) for( iter = list_devices.begin(); iter != list_devices.end(); iter++ )
msg_Dbg( p_input, "found device: %s", iter->c_str() ); msg_Dbg( p_input, "found device: %s", iter->c_str() );
......
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