Use isset() to avoid an E_NOTICE about an undefined index
authorJack Phoenix <ashley@uncyclomedia.co>
Fri, 29 Mar 2019 17:49:36 +0000 (19:49 +0200)
committerJack Phoenix <ashley@uncyclomedia.co>
Fri, 29 Mar 2019 17:49:36 +0000 (19:49 +0200)
Change-Id: Ida990c474a7e4269dc2df989232eea5cb7b83345

includes/media/GIFHandler.php

index 556e83c..9ef37fb 100644 (file)
@@ -86,8 +86,11 @@ class GIFHandler extends BitmapHandler {
                $ser = $image->getMetadata();
                if ( $ser ) {
                        $metadata = unserialize( $ser );
-
-                       return $image->getWidth() * $image->getHeight() * $metadata['frameCount'];
+                       if ( isset( $metadata['frameCount'] ) && $metadata['frameCount'] > 0 ) {
+                               return $image->getWidth() * $image->getHeight() * $metadata['frameCount'];
+                       } else {
+                               return $image->getWidth() * $image->getHeight();
+                       }
                } else {
                        return $image->getWidth() * $image->getHeight();
                }
@@ -101,7 +104,7 @@ class GIFHandler extends BitmapHandler {
                $ser = $image->getMetadata();
                if ( $ser ) {
                        $metadata = unserialize( $ser );
-                       if ( $metadata['frameCount'] > 1 ) {
+                       if ( isset( $metadata['frameCount'] ) && $metadata['frameCount'] > 1 ) {
                                return true;
                        }
                }