Handle unsupported embedded thumbnails correctly.

This commit is contained in:
Steve Herrell
2010-12-04 13:28:50 -05:00
parent dc0b305ba1
commit 3edfd841eb

View File

@@ -154,11 +154,11 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
Image16* img = new Image16 (); Image16* img = new Image16 ();
int err = 1;
// see if it is something we support // see if it is something we support
if ( ri->is_supportedThumb() ) if ( ri->is_supportedThumb() )
{ {
int err = 1;
const char* data((const char*)fdata(ri->get_thumbOffset(),ri->get_file())); const char* data((const char*)fdata(ri->get_thumbOffset(),ri->get_file()));
if ( (unsigned char)data[1] == 0xd8 ) if ( (unsigned char)data[1] == 0xd8 )
{ {
@@ -168,7 +168,9 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
{ {
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());
} }
}
// did we succeed?
if ( err ) if ( err )
{ {
printf("loadfromMemory: error\n"); printf("loadfromMemory: error\n");
@@ -176,7 +178,6 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
delete ri; delete ri;
return NULL; return NULL;
} }
}
Thumbnail* tpp = new Thumbnail (); Thumbnail* tpp = new Thumbnail ();