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:
@@ -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
|
||||
|
Reference in New Issue
Block a user