]> git.imager.perl.org - imager.git/blobdiff - Imager.pm
[rt.cpan.org #29938] add matrix() method to Imager::Matrix2d
[imager.git] / Imager.pm
index bf50028c4b8e18e88c9e0c94131d2c0ec463ae89..869dabc4fc153bc3915161bccae7c76a2afa265b 100644 (file)
--- a/Imager.pm
+++ b/Imager.pm
@@ -913,11 +913,16 @@ sub masked {
   $result->{IMG} = i_img_masked_new($self->{IMG}, $mask, $opts{left}, 
                                     $opts{top}, $opts{right} - $opts{left},
                                     $opts{bottom} - $opts{top});
+  unless ($result->{IMG}) {
+    $self->_set_error(Imager->_error_as_msg);
+    return;
+  }
+
   # keep references to the mask and base images so they don't
   # disappear on us
   $result->{DEPENDS} = [ $self->{IMG}, $mask ];
 
-  $result;
+  return $result;
 }
 
 # convert an RGB image into a paletted image