]> git.sesse.net Git - vlc/commitdiff
* ./modules/access/dvdplay/intf.c: added a sanity check upon initialization
authorSam Hocevar <sam@videolan.org>
Wed, 29 Jan 2003 15:55:44 +0000 (15:55 +0000)
committerSam Hocevar <sam@videolan.org>
Wed, 29 Jan 2003 15:55:44 +0000 (15:55 +0000)
    in case the input dies before we even spawned our dvdplay interface
    (Closes: #141).

modules/access/dvdplay/intf.c

index e4893c60cd44f63e16c3f245dadb2cf3520243ab..e5a5e0b7a5ee45c53d5404d2e3c3a5aa61ab0220 100644 (file)
@@ -2,7 +2,7 @@
  * intf.c: interface for DVD video manager
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: intf.c,v 1.5 2003/01/12 15:38:35 sigmunau Exp $
+ * $Id: intf.c,v 1.6 2003/01/29 15:55:44 sam Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -310,15 +310,21 @@ static void RunIntf( intf_thread_t *p_intf )
  *****************************************************************************/
 static int InitThread( intf_thread_t * p_intf )
 {
-    /* we might need some locking here */
+    /* We might need some locking here */
     if( !p_intf->b_die )
     {
         input_thread_t * p_input;
         dvd_data_t * p_dvd;
 
         p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_PARENT );
-        p_dvd = (dvd_data_t*)p_input->p_access_data;
 
+        /* Maybe the input just died */
+        if( p_input == NULL )
+        {
+            return VLC_EGENERIC;
+        }
+
+        p_dvd = (dvd_data_t*)p_input->p_access_data;
         p_dvd->p_intf = p_intf;
 
         vlc_mutex_lock( &p_intf->change_lock );
@@ -332,11 +338,11 @@ static int InitThread( intf_thread_t * p_intf )
 
         vlc_mutex_unlock( &p_intf->change_lock );
 
-        return 0;
+        return VLC_SUCCESS;
     }
     else
     {
-        return -1;
+        return VLC_EGENERIC;
     }
 }