From 40e196f4a61b0ced042a8a2c79b300c46145b436 Mon Sep 17 00:00:00 2001 From: faust3 Date: Sat, 6 Aug 2005 18:19:58 +0000 Subject: [PATCH] do not crash when /dev/video0 is not present git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16186 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/tvi_v4l2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libmpdemux/tvi_v4l2.c b/libmpdemux/tvi_v4l2.c index d33fc70d08..1508e14285 100644 --- a/libmpdemux/tvi_v4l2.c +++ b/libmpdemux/tvi_v4l2.c @@ -857,7 +857,8 @@ static int uninit(priv_t *priv) 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 @@ static int uninit(priv_t *priv) /* 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) { -- 2.11.4.GIT