Added filename emptyness check to the Exif reader, fixes 6120

pull/6121/head
Maksim Shabunin 9 years ago
parent 8c591ebd77
commit a54870aace
  1. 13
      modules/imgcodecs/src/grfmt_jpeg.cpp
  2. 5
      modules/imgcodecs/src/jpeg_exif.cpp

@ -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
}
}
}

@ -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 )

Loading…
Cancel
Save