* Fix crash bug if loading exif data from an image fails.

This commit is contained in:
Justin Maggard 2009-06-22 22:27:15 +00:00
parent 8ac7452577
commit 84a2f22e66

View File

@ -365,6 +365,8 @@ GetImageMetadata(const char * path, char * name)
exif_loader_write_file(l, path); exif_loader_write_file(l, path);
ed = exif_loader_get_data(l); ed = exif_loader_get_data(l);
exif_loader_unref(l); exif_loader_unref(l);
if( !ed )
goto no_exifdata;
tag = EXIF_TAG_PIXEL_X_DIMENSION; tag = EXIF_TAG_PIXEL_X_DIMENSION;
e = exif_content_get_entry(ed->ifd[EXIF_IFD_EXIF], tag); e = exif_content_get_entry(ed->ifd[EXIF_IFD_EXIF], tag);
@ -435,6 +437,7 @@ GetImageMetadata(const char * path, char * name)
exif_data_unref(ed); exif_data_unref(ed);
no_exifdata:
/* If EXIF parsing fails, then fall through to reading the JPEG data with libjpeg to get the resolution */ /* If EXIF parsing fails, then fall through to reading the JPEG data with libjpeg to get the resolution */
if( !width || !height ) if( !width || !height )
{ {