changeset 17342:adb64d908347

fix crash if no video codec available
author reimar
date Sun, 08 Jan 2006 13:35:54 +0000
parents c919e346b0d1
children b07bb7ee7ce4
files libmpdemux/demux_avi.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_avi.c	Sun Jan 08 10:18:18 2006 +0000
+++ b/libmpdemux/demux_avi.c	Sun Jan 08 13:35:54 2006 +0000
@@ -837,13 +837,13 @@
 
     switch(cmd) {
 	case DEMUXER_CTRL_GET_TIME_LENGTH:
-    	    if (!priv->numberofframes) return DEMUXER_CTRL_DONTKNOW;
+    	    if (!priv->numberofframes || !sh_video) return DEMUXER_CTRL_DONTKNOW;
 	    *((double *)arg)=(double)priv->numberofframes/sh_video->fps;
 	    if (sh_video->video.dwLength<=1) return DEMUXER_CTRL_GUESS;
 	    return DEMUXER_CTRL_OK;
 
 	case DEMUXER_CTRL_GET_PERCENT_POS:
-    	    if (!priv->numberofframes) {
+    	    if (!priv->numberofframes || !sh_video) {
               return DEMUXER_CTRL_DONTKNOW;
 	    }
 	    *((int *)arg)=(int)(priv->video_pack_no*100/priv->numberofframes);