diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index fd7e0eb..f9888a8 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -314,13 +314,14 @@ impl Decoder { /// Initializes the decoder. pub fn init(mut self) -> TiffResult> { try!(self.read_header()); - self.next_image() + self.next_image()?; + Ok(self) } /// Reads in the next image. /// If there is no further image in the TIFF file a format error is returned. /// To determine whether there are more images call `TIFFDecoder::more_images` instead. - pub fn next_image(mut self) -> TiffResult> { + pub fn next_image(&mut self) -> TiffResult<()> { self.ifd = Some(try!(self.read_ifd())); self.width = try!(self.get_tag_u32(ifd::Tag::ImageWidth)); self.height = try!(self.get_tag_u32(ifd::Tag::ImageLength)); @@ -365,7 +366,7 @@ impl Decoder { )) } } - Ok(self) + Ok(()) } /// Returns `true` if there is at least one more image available.