changeset 35257:9a46ec65165d

Fix potential NULL dereference.
author reimar
date Mon, 05 Nov 2012 21:02:38 +0000
parents 4ca7b3dfb574
children 109f7c33a9b6
files libmpcodecs/ad_ffmpeg.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_ffmpeg.c	Mon Nov 05 20:58:38 2012 +0000
+++ b/libmpcodecs/ad_ffmpeg.c	Mon Nov 05 21:02:38 2012 +0000
@@ -150,12 +150,12 @@
    if(sh_audio->format==0x3343414D){
        // MACE 3:1
        sh_audio->ds->ss_div = 2*3; // 1 samples/packet
-       sh_audio->ds->ss_mul = 2*sh_audio->wf->nChannels; // 1 byte*ch/packet
+       sh_audio->ds->ss_mul = sh_audio->wf ? 2*sh_audio->wf->nChannels : 2; // 1 byte*ch/packet
    } else
    if(sh_audio->format==0x3643414D){
        // MACE 6:1
        sh_audio->ds->ss_div = 2*6; // 1 samples/packet
-       sh_audio->ds->ss_mul = 2*sh_audio->wf->nChannels; // 1 byte*ch/packet
+       sh_audio->ds->ss_mul = sh_audio->wf ? 2*sh_audio->wf->nChannels : 2; // 1 byte*ch/packet
    }
 
    // Decode at least 1 byte:  (to get header filled)