Skip to content

Commit

Permalink
Fix potential null pointer derefence. Coverity 700394
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartm committed Jun 6, 2013
1 parent ec7710b commit 8cafd06
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mythtv/libs/libmythtv/avformatdecoder.cpp
Expand Up @@ -1380,8 +1380,9 @@ void AvFormatDecoder::InitVideoCodec(AVStream *stream, AVCodecContext *enc,
FlagIsSet(kDecodeFewBlocks) || FlagIsSet(kDecodeNoLoopFilter) ||
FlagIsSet(kDecodeNoDecode))
{
if ((AV_CODEC_ID_MPEG2VIDEO == codec->id) ||
(AV_CODEC_ID_MPEG1VIDEO == codec->id))
if (codec &&
((AV_CODEC_ID_MPEG2VIDEO == codec->id) ||
(AV_CODEC_ID_MPEG1VIDEO == codec->id)))
{
if (FlagIsSet(kDecodeFewBlocks))
{
Expand All @@ -1393,7 +1394,7 @@ void AvFormatDecoder::InitVideoCodec(AVStream *stream, AVCodecContext *enc,
if (FlagIsSet(kDecodeLowRes))
enc->lowres = 2; // 1 = 1/2 size, 2 = 1/4 size
}
else if (AV_CODEC_ID_H264 == codec->id)
else if (codec && (AV_CODEC_ID_H264 == codec->id))
{
if (FlagIsSet(kDecodeNoLoopFilter))
{
Expand Down

0 comments on commit 8cafd06

Please sign in to comment.