Merge pull request #6121 from mshabunin:fix-check-imencode-exif

This commit is contained in:
Alexander Alekhin 2016-02-17 00:45:49 +00:00
commit 2549bafe4f
2 changed files with 13 additions and 5 deletions

View File

@ -267,13 +267,16 @@ int JpegDecoder::getOrientation()
{
int orientation = JPEG_ORIENTATION_TL;
ExifReader reader( m_filename );
if( reader.parse() )
if (m_filename.size() > 0)
{
ExifEntry_t entry = reader.getTag( ORIENTATION );
if (entry.tag != INVALID_TAG)
ExifReader reader( m_filename );
if( reader.parse() )
{
orientation = entry.field_u16; //orientation is unsigned short, so check field_u16
ExifEntry_t entry = reader.getTag( ORIENTATION );
if (entry.tag != INVALID_TAG)
{
orientation = entry.field_u16; //orientation is unsigned short, so check field_u16
}
}
}

View File

@ -128,6 +128,11 @@ std::map<int, ExifEntry_t > ExifReader::getExif()
size_t count;
if (m_filename.size() == 0)
{
return m_exif;
}
FILE* f = fopen( m_filename.c_str(), "rb" );
if( !f )