lib/pigato/client.rb in pigato-0.2.3 vs lib/pigato/client.rb in pigato-0.2.4
- old
+ new
@@ -34,10 +34,11 @@
break if chunk == nil
res << Oj.load(chunk[4])
break if chunk[0] == Pigato::W_REPLY
end
- return res[0] if res.length == 1
+ return nil if res.length == 1
+ return res[0] if res.length == 0
res
end
def _recv rid, timeout = @timeout
@socket.rcvtimeo = timeout;