lib/cosmos/streams/template_stream_protocol.rb in cosmos-3.2.1 vs lib/cosmos/streams/template_stream_protocol.rb in cosmos-3.3.0
- old
+ new
@@ -124,10 +124,10 @@
response_regexp = Regexp.new(response_template)
# Scan the response for the variables in brackets <VARIABLE>
# Write the packet value with each of the values received
response_values = response_string.scan(response_regexp)[0]
- raise "Unexpected response received: #{response_string}" if response_values.length != response_item_names.length
+ raise "Unexpected response received: #{response_string}" if !response_values or (response_values.length != response_item_names.length)
response_values.each_with_index do |value, i|
result_packet.write(response_item_names[i], value)
end
@read_queue << result_packet