catch /0 in exif read

This commit is contained in:
John Cupitt 2019-08-25 11:29:37 +01:00
parent 6c525e144b
commit db6e6a0076

View File

@ -237,14 +237,25 @@ vips_exif_get_double( ExifData *ed,
{
ExifRational rv;
ExifSRational srv;
double value;
if( !vips_exif_get_rational( ed, entry, component, &rv ) )
*out = (double) rv.numerator / rv.denominator;
else if( !vips_exif_get_srational( ed, entry, component, &srv ) )
*out = (double) srv.numerator / srv.denominator;
if( !vips_exif_get_rational( ed, entry, component, &rv ) ) {
if( rv.denominator == 0 )
value = 0;
else
value = (double) rv.numerator / rv.denominator;
}
else if( !vips_exif_get_srational( ed, entry, component, &srv ) ) {
if( srv.denominator == 0 )
value = 0;
else
value = (double) srv.numerator / srv.denominator;
}
else
return( -1 );
*out = value;
return( 0 );
}