test for res-unit meta before fetching

if the res-unit meta is missing, don't generate an error message
This commit is contained in:
John Cupitt 2011-06-16 11:34:20 +01:00
parent f85c36edee
commit 6a582ae1a9
1 changed files with 3 additions and 1 deletions

View File

@ -1223,7 +1223,9 @@ make_tiff_write( IMAGE *im, const char *filename )
tw->resunit = RESUNIT_CENTIMETER;
tw->xres = im->Xres * 10;
tw->yres = im->Yres * 10;
if( !im_meta_get_string( im, IM_META_RESOLUTION_UNIT, &p ) &&
if( vips_image_get_typeof( im, IM_META_RESOLUTION_UNIT ) &&
!im_meta_get_string( im, IM_META_RESOLUTION_UNIT, &p ) &&
strcmp( p, "in" ) == 0 ) {
tw->resunit = RESUNIT_INCH;
tw->xres *= 2.54;