return NULL;
}
+ if (!ImageNum) {
+ /* there were no images */
+ i_push_error(0, "no images found in file");
+ return NULL;
+ }
+
if (ImageNum && page != -1) {
/* there were images, but the page selected wasn't found */
i_push_errorf(0, "page %d not found (%d total)", page, ImageNum);
#!perl -w
use strict;
-use Test::More tests => 9;
+use Test::More;
use Imager;
use Imager::Test qw(test_image);
is($rd->colorcount, 2, "should only have 2 colors");
}
+{
+ my $im = Imager->new;
+ ok(!$im->read(data => "GIF89a;;;;;;;;", type => "gif" ),
+ "fail to read a file with no images");
+ like($im->errstr, qr/no images found in file/,
+ "check the error message");
+}
+
Imager->close_log;
+
+done_testing();