[MPlayer-cvslog] r30120 - trunk/command.c

reimar subversion at mplayerhq.hu
Sun Dec 27 15:02:21 CET 2009


Author: reimar
Date: Sun Dec 27 15:02:20 2009
New Revision: 30120

Log:
When setting audio or video track make sure we will not try to
dereference a NULL pointer, e.g. because there is no video stream.

Modified:
   trunk/command.c

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	Sun Dec 27 14:56:51 2009	(r30119)
+++ trunk/command.c	Sun Dec 27 15:02:20 2009	(r30120)
@@ -840,7 +840,7 @@ static int mp_property_audio(m_option_t 
 
     case M_PROPERTY_STEP_UP:
     case M_PROPERTY_SET:
-	if (!mpctx->demuxer)
+	if (!mpctx->demuxer || !mpctx->demuxer->audio)
 	    return M_PROPERTY_UNAVAILABLE;
 	if (action == M_PROPERTY_SET && arg)
 	    tmp = *((int *) arg);
@@ -900,11 +900,13 @@ static int mp_property_video(m_option_t 
 
     case M_PROPERTY_STEP_UP:
     case M_PROPERTY_SET:
-	current_id = mpctx->demuxer->video->id;
+	if (!mpctx->demuxer || !mpctx->demuxer->video)
+	    return M_PROPERTY_UNAVAILABLE;
 	if (action == M_PROPERTY_SET && arg)
 	    tmp = *((int *) arg);
 	else
 	    tmp = -1;
+	current_id = mpctx->demuxer->video->id;
 	video_id = demuxer_switch_video(mpctx->demuxer, tmp);
 	if (video_id == -2
 	    || (video_id > -1 && mpctx->demuxer->video->id != current_id


More information about the MPlayer-cvslog mailing list