Skip to content

Commit 7c2e6fc

Browse files
author
Clement Champetier
committed
FileProperties: fix crash if try to get NULL data as string
1 parent 7f63c93 commit 7c2e6fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/AvTranscoder/mediaProperty/FileProperties.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ FileProperties::FileProperties( const FormatContext& formatContext )
2020

2121
std::string FileProperties::getFilename() const
2222
{
23-
if( ! _formatContext )
23+
if( ! _formatContext || ! _formatContext->filename )
2424
throw std::runtime_error( "unknown format context" );
2525
return _formatContext->filename;
2626
}
2727

2828
std::string FileProperties::getFormatName() const
2929
{
30-
if( ! _formatContext || ! _formatContext->iformat )
30+
if( ! _formatContext || ! _formatContext->iformat || ! _formatContext->iformat->name )
3131
throw std::runtime_error( "unknown format context" );
3232
return _formatContext->iformat->name;
3333
}
3434

3535
std::string FileProperties::getFormatLongName() const
3636
{
37-
if( ! _formatContext || ! _formatContext->iformat )
37+
if( ! _formatContext || ! _formatContext->iformat || ! _formatContext->iformat->long_name )
3838
throw std::runtime_error( "unknown format context" );
3939
return _formatContext->iformat->long_name;
4040
}

0 commit comments

Comments
 (0)