Commit 708b80c4 authored by Olivier Aubert's avatar Olivier Aubert

src/control/mediacontrol_init.c: check return values of VLC_Create and VLC_Init

parent 41998e06
......@@ -40,13 +40,20 @@ mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *ex
ppsz_argv[i_count + 1] = NULL;
p_vlc_id = VLC_Create();
if( p_vlc_id < 0 )
{
exception->code = mediacontrol_InternalException;
exception->message = strdup( "Unable to create VLC" );
return NULL;
}
p_vlc = ( vlc_object_t* )vlc_current_object( p_vlc_id );
if( ! p_vlc )
{
exception->code = mediacontrol_InternalException;
exception->message = strdup( "Unable to initialize VLC" );
exception->message = strdup( "Unable to find VLC object" );
return NULL;
}
retval = ( mediacontrol_Instance* )malloc( sizeof( mediacontrol_Instance ) );
......@@ -57,7 +64,12 @@ mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *ex
return NULL;
}
VLC_Init( p_vlc_id, i_count + 1, ppsz_argv );
if( VLC_Init( p_vlc_id, i_count + 1, ppsz_argv ) != VLC_SUCCESS )
{
exception->code = mediacontrol_InternalException;
exception->message = strdup( "Cannot initialize VLC" );
return NULL;
}
retval->p_vlc = p_vlc;
retval->vlc_object_id = p_vlc_id;
......
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