utf8s.RuneReader

master
Charles Iliya Krempeaux 2018-07-10 20:56:30 -07:00
parent 5bbcb5d54a
commit f81ca5284f
2 changed files with 5 additions and 0 deletions

View File

@ -8,5 +8,6 @@ var (
errInternalError = errors.New("Internal Error") errInternalError = errors.New("Internal Error")
errInvalidUTF8 = internalInvalidUTF8Complainer{} errInvalidUTF8 = internalInvalidUTF8Complainer{}
errNilReader = internalNilReaderComplainer{} errNilReader = internalNilReaderComplainer{}
errNilReceiver = errors.New("Nil Receiver")
errNilWriter = internalNilWriterComplainer{} errNilWriter = internalNilWriterComplainer{}
) )

View File

@ -16,6 +16,10 @@ func NewRuneReader(reader io.Reader) *RuneReader {
} }
func (receiver *RuneReader) ReadRune() (rune, int, error) { func (receiver *RuneReader) ReadRune() (rune, int, error) {
if nil == receiver {
return 0, 0, errNilReceiver
}
reader := receiver.reader reader := receiver.reader
if nil == reader { if nil == reader {
return 0, 0, errNilReader return 0, 0, errNilReader