check return from spng_get_text()
it'll fail for no text elements rather than returning 0
This commit is contained in:
parent
b7a285e84b
commit
94b137d526
@ -192,7 +192,6 @@ vips_foreign_load_png_set_header( VipsForeignLoadPng *png, VipsImage *image )
|
|||||||
{
|
{
|
||||||
double xres, yres;
|
double xres, yres;
|
||||||
struct spng_iccp iccp;
|
struct spng_iccp iccp;
|
||||||
struct spng_text *text;
|
|
||||||
struct spng_exif exif;
|
struct spng_exif exif;
|
||||||
struct spng_phys phys;
|
struct spng_phys phys;
|
||||||
guint32 n_text;
|
guint32 n_text;
|
||||||
@ -232,8 +231,11 @@ vips_foreign_load_png_set_header( VipsForeignLoadPng *png, VipsImage *image )
|
|||||||
vips_image_set_blob_copy( image,
|
vips_image_set_blob_copy( image,
|
||||||
VIPS_META_ICC_NAME, iccp.profile, iccp.profile_len );
|
VIPS_META_ICC_NAME, iccp.profile, iccp.profile_len );
|
||||||
|
|
||||||
spng_get_text( png->ctx, NULL, &n_text );
|
if( !spng_get_text( png->ctx, NULL, &n_text ) ) {
|
||||||
text = VIPS_ARRAY( VIPS_OBJECT( png ), n_text, struct spng_text );
|
struct spng_text *text;
|
||||||
|
|
||||||
|
text = VIPS_ARRAY( VIPS_OBJECT( png ),
|
||||||
|
n_text, struct spng_text );
|
||||||
if( !spng_get_text( png->ctx, text, &n_text ) ) {
|
if( !spng_get_text( png->ctx, text, &n_text ) ) {
|
||||||
guint32 i;
|
guint32 i;
|
||||||
|
|
||||||
@ -243,6 +245,7 @@ vips_foreign_load_png_set_header( VipsForeignLoadPng *png, VipsImage *image )
|
|||||||
vips_foreign_load_png_set_text( image,
|
vips_foreign_load_png_set_text( image,
|
||||||
i, text[i].keyword, text[i].text );
|
i, text[i].keyword, text[i].text );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( !spng_get_exif( png->ctx, &exif ) )
|
if( !spng_get_exif( png->ctx, &exif ) )
|
||||||
vips_image_set_blob_copy( image, VIPS_META_EXIF_NAME,
|
vips_image_set_blob_copy( image, VIPS_META_EXIF_NAME,
|
||||||
|
Loading…
Reference in New Issue
Block a user