changeset 16185:973b82bf1187

do not crash when /dev/video0 is not present
author faust3
date Sat, 06 Aug 2005 18:19:58 +0000
parents 04dd5945fab8
children e861f9b7a70e
files libmpdemux/tvi_v4l2.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/tvi_v4l2.c	Sat Aug 06 16:15:07 2005 +0000
+++ b/libmpdemux/tvi_v4l2.c	Sat Aug 06 18:19:58 2005 +0000
@@ -857,7 +857,8 @@
     int i, frames, dropped = 0;
 
     priv->shutdown = 1;
-    pthread_join(priv->video_grabber_thread, NULL);
+    if(priv->video_grabber_thread)
+	pthread_join(priv->video_grabber_thread, NULL);
     pthread_mutex_destroy(&priv->video_buffer_mutex);
 
     if (priv->streamon) {
@@ -906,7 +907,7 @@
     /* free memory and close device */
     free(priv->map);		priv->map = NULL;
     priv->mapcount = 0;
-    close(priv->video_fd);	priv->video_fd  = -1;
+    if(priv->video_fd!=-1)close(priv->video_fd);	priv->video_fd  = -1;
     free(priv->video_dev);	priv->video_dev = NULL;
 
     if (priv->video_ringbuffer) {