From be4d5d90bbbeb615f840c9d5b20bdbb71f2f9d5c Mon Sep 17 00:00:00 2001 From: gwillcox-r7 Date: Tue, 4 Aug 2020 14:58:01 -0500 Subject: [PATCH] Update fix to use 'if' statement rather than 'unless' as this makes more sense here. --- lib/postgres/postgres-pr/message.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/postgres/postgres-pr/message.rb b/lib/postgres/postgres-pr/message.rb index 8041c7ced9..b2844a05c7 100644 --- a/lib/postgres/postgres-pr/message.rb +++ b/lib/postgres/postgres-pr/message.rb @@ -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.nil? && length >= 4) + raise ParseError if (!length.nil? || length >= 4) # If we didn't read any bytes and startup was not set, then type will be nil, so don't continue. unless startup