1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-01 11:30:16 +02:00

Add exception when animation frame could not be found

This commit is contained in:
Oliver Vogel
2024-01-15 09:56:46 +01:00
parent a00138403a
commit f9355c4344

View File

@@ -3,6 +3,7 @@
namespace Intervention\Image\Drivers\Gd;
use Intervention\Image\Collection;
use Intervention\Image\Exceptions\AnimationException;
use Intervention\Image\Interfaces\CoreInterface;
use Intervention\Image\Interfaces\FrameInterface;
@@ -31,7 +32,13 @@ class Core extends Collection implements CoreInterface
public function frame(int $position): FrameInterface
{
return $this->getAtPosition($position);
$frame = $this->getAtPosition($position);
if (!($frame instanceof FrameInterface)) {
throw new AnimationException('Frame #' . $position . ' could not be found in the image.');
}
return $frame;
}
public function loops(): int