Fix crash when opening a folder containing dng files with corrupted thumbs, fixes #3129

This commit is contained in:
heckflosse 2016-02-02 15:31:30 +01:00
parent 80085787a1
commit 8c3e6eab95
3 changed files with 19 additions and 1 deletions

View File

@ -743,6 +743,22 @@ RawImage::is_supportedThumb() const
!thumb_load_raw ); !thumb_load_raw );
} }
bool
RawImage::is_jpegThumb() const
{
return ( (thumb_width * thumb_height) > 0 &&
write_thumb == &rtengine::RawImage::jpeg_thumb &&
!thumb_load_raw );
}
bool
RawImage::is_ppmThumb() const
{
return ( (thumb_width * thumb_height) > 0 &&
write_thumb == &rtengine::RawImage::ppm_thumb &&
!thumb_load_raw );
}
void RawImage::getXtransMatrix( char XtransMatrix[6][6]) void RawImage::getXtransMatrix( char XtransMatrix[6][6])
{ {
for(int row = 0; row < 6; row++) for(int row = 0; row < 6; row++)

View File

@ -275,6 +275,8 @@ public:
return ifp; return ifp;
} }
bool is_supportedThumb() const ; bool is_supportedThumb() const ;
bool is_jpegThumb() const ;
bool is_ppmThumb() const ;
int get_thumbOffset() int get_thumbOffset()
{ {
return int(thumb_offset); return int(thumb_offset);

View File

@ -182,7 +182,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
if ( (unsigned char)data[1] == 0xd8 ) { if ( (unsigned char)data[1] == 0xd8 ) {
err = img->loadJPEGFromMemory(data, ri->get_thumbLength()); err = img->loadJPEGFromMemory(data, ri->get_thumbLength());
} else { } else if (ri->is_ppmThumb()) {
err = img->loadPPMFromMemory(data, ri->get_thumbWidth(), ri->get_thumbHeight(), ri->get_thumbSwap(), ri->get_thumbBPS()); err = img->loadPPMFromMemory(data, ri->get_thumbWidth(), ri->get_thumbHeight(), ri->get_thumbSwap(), ri->get_thumbBPS());
} }
} }