summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-12-27 14:02:20 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-12-27 14:02:20 +0000
commitea54d1771f9c15daf4afa25da15b92d77ae9dfba (patch)
treee90a5ff065d063554e408e949a72190f539c4131 /command.c
parent683844573727783b273fd51bd19b82b16363ac62 (diff)
downloadmpv-ea54d1771f9c15daf4afa25da15b92d77ae9dfba.tar.bz2
mpv-ea54d1771f9c15daf4afa25da15b92d77ae9dfba.tar.xz
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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30120 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'command.c')
-rw-r--r--command.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/command.c b/command.c
index c1cfdc60ec..6539fe9017 100644
--- a/command.c
+++ b/command.c
@@ -840,7 +840,7 @@ static int mp_property_audio(m_option_t * prop, int action, void *arg,
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 * prop, int action, void *arg,
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