fix crash with some openslide images

some openslide images seem to have null properties

see https://github.com/libvips/libvips/issues/1723
This commit is contained in:
John Cupitt 2020-07-17 10:50:09 +01:00
parent 0a4d4daf5e
commit 43385c928d

View File

@ -515,14 +515,20 @@ readslide_parse( ReadSlide *rslide, VipsImage *image )
for( properties = openslide_get_property_names( rslide->osr );
*properties != NULL; properties++ ) {
vips_image_set_string( image, *properties,
openslide_get_property_value( rslide->osr,
*properties ) );
const char *name = *properties;
const char *value =
openslide_get_property_value( rslide->osr, name );
if( strcmp( *properties, "openslide.mpp-x" ) == 0 )
xres = readslice_parse_res( rslide, *properties );
if( strcmp( *properties, "openslide.mpp-y" ) == 0 )
yres = readslice_parse_res( rslide, *properties );
/* Can be NULL for some openslides with some images.
*/
if( value ) {
vips_image_set_string( image, name, value );
if( strcmp( *properties, "openslide.mpp-x" ) == 0 )
xres = readslice_parse_res( rslide, name );
if( strcmp( *properties, "openslide.mpp-y" ) == 0 )
yres = readslice_parse_res( rslide, name );
}
}
associated_names = g_strjoinv( ", ", (char **)