svenvc / zinc

Zinc HTTP Components is an open-source Smalltalk framework to deal with the HTTP networking protocol.
MIT License
97 stars 57 forks source link

Setting ZnEncodedReadStream to end by explicit position raises error #130

Closed daniels220 closed 11 months ago

daniels220 commented 11 months ago

ZnEncodedStream>>setToEnd simply defers to the underlying stream—sensible enough—but the call to #ensureAtBeginOfCodePointOnStream: in #position: encounters an error if the provided position corresponds to end-of-stream. I've seen this come up when writing a method that uses a save/move/restore position pattern, where the position it happens to save is at end-of-stream.

Seems like an easy fix, just early-out of #ensureAtBeginOfCodePointOnStream: if the stream is atEnd—I'll make a PR soon.