From c3ffe405cff6abf4e8ae10114f06a9bae752030e Mon Sep 17 00:00:00 2001 From: Cristian Thiago Moecke Date: Fri, 21 Feb 2014 03:44:54 -0800 Subject: [PATCH] Fix to #380. DialogSocket was crashing (SIGSEGV) when a timeout occours. --- Net/src/DialogSocket.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Net/src/DialogSocket.cpp b/Net/src/DialogSocket.cpp index 0af7d8b45..33d9ebf1c 100644 --- a/Net/src/DialogSocket.cpp +++ b/Net/src/DialogSocket.cpp @@ -239,8 +239,11 @@ void DialogSocket::refill() if (_pNext == _pEnd) { int n = receiveBytes(_pBuffer, RECEIVE_BUFFER_SIZE); - _pNext = _pBuffer; - _pEnd = _pBuffer + n; + if (n > 0) + { + _pNext = _pBuffer; + _pEnd = _pBuffer + n; + } } }