diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2013-02-19 12:18:12 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-02-19 12:03:25 +0000 |
commit | e818eedacaddad52c83d3102df8f1183a675697c (patch) | |
tree | 0e830b7c9f356ff6db94e53e0236b06dc80db2e7 | |
parent | 156be5f435bcaddfeaffa1055c9be9be8aa3b27a (diff) |
Fix crashes in sdremote after suspend/resume cycles.
Change-Id: I0f64820887919386f266290ae8b7c53f8a0a5458
Signed-off-by: Michael Meeks <michael.meeks@suse.com>
-rw-r--r-- | sd/source/ui/remotecontrol/BufferedStreamSocket.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Receiver.cxx | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sd/source/ui/remotecontrol/BufferedStreamSocket.cxx b/sd/source/ui/remotecontrol/BufferedStreamSocket.cxx index c4f7f611f665..71fec179c009 100644 --- a/sd/source/ui/remotecontrol/BufferedStreamSocket.cxx +++ b/sd/source/ui/remotecontrol/BufferedStreamSocket.cxx @@ -73,7 +73,7 @@ sal_Int32 BufferedStreamSocket::readLine( OString& aLine ) // Process buffer first incase data already present. vector<char>::iterator aIt; if ( (aIt = find( aBuffer.begin(), aBuffer.end(), '\n' )) - != aBuffer.end() ) + != aBuffer.end() ) { sal_uInt64 aLocation = aIt - aBuffer.begin(); @@ -92,9 +92,9 @@ sal_Int32 BufferedStreamSocket::readLine( OString& aLine ) else aRet = ::recv( mSocket, &aBuffer[aRead], 100, 0 ); - if ( aRet == 0 ) + if ( aRet <= 0 ) { - return aRet; + return 0; } // Prevent buffer from growing massively large. if ( aRead > MAX_LINE_LENGTH ) diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx index c3e7d8a1f18f..eaa2c6ec763b 100644 --- a/sd/source/ui/remotecontrol/Receiver.cxx +++ b/sd/source/ui/remotecontrol/Receiver.cxx @@ -51,7 +51,8 @@ void Receiver::Timeout() { std::vector< rtl::OString > aCommands( maExecQueue.front() ); maExecQueue.pop_front(); - executeCommand( aCommands ); + if( !aCommands.empty() ) + executeCommand( aCommands ); Start(); } else |