avoid nil pointer dereference panic when freeing unavailable stream

This commit is contained in:
lukas 2021-09-27 20:42:01 +02:00
parent 881281af70
commit ecef80f87f

View File

@ -177,9 +177,11 @@ func decodePic(srcFileName string, decodeExtension string, time uint64) (pic *[]
} }
for i := 0; i < inputCtx.StreamsCnt(); i++ { for i := 0; i < inputCtx.StreamsCnt(); i++ {
st, _ := inputCtx.GetStream(i) st, err := inputCtx.GetStream(i)
if err == nil && st != nil {
st.CodecCtx().Free() st.CodecCtx().Free()
st.Free() st.Free()
} }
}
return return
} }