Merge pull request #1504 from deftomat/webp-delay-fix

fix: do not try to use "undefined" delay during WEBP animation save
This commit is contained in:
John Cupitt 2019-12-20 15:21:01 +00:00 committed by GitHub
commit ff2b934244
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -330,6 +330,7 @@ write_webp_anim( VipsWebPWrite *write, VipsImage *image, int page_height )
/* New images have an array of ints instead.
*/
delay_length = 0;
if( vips_image_get_typeof( image, "delay" ) &&
vips_image_get_array_int( image, "delay",
&delay, &delay_length ) )
@ -363,8 +364,7 @@ write_webp_anim( VipsWebPWrite *write, VipsImage *image, int page_height )
WebPPictureFree( &pic );
page_index = top / page_height;
if( delay &&
page_index < delay_length )
if( page_index < delay_length )
timestamp_ms += delay[page_index];
else
timestamp_ms += gif_delay * 10;