Fix up lib/postgres/postgre-pr/message.rb and its self.read function so that it will handle cases where stream reads might not return any bytes at all, resulting in length being nil
This commit is contained in:
parent
f49bf7b09a
commit
c196d9b733
|
@ -46,7 +46,7 @@ class Message
|
|||
type = stream.read_exactly_n_bytes(1) unless startup
|
||||
length = stream.read_exactly_n_bytes(4).to_s.unpack('N').first # FIXME: length should be signed, not unsigned
|
||||
|
||||
raise ParseError unless length >= 4
|
||||
raise ParseError unless (!length.nil? && length >= 4)
|
||||
|
||||
# initialize buffer
|
||||
buffer = Buffer.of_size(startup ? length : 1+length)
|
||||
|
|
Loading…
Reference in New Issue