mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Throw exception instead of failing with SIGSEGV
This commit is contained in:
@@ -148,6 +148,9 @@ void CConnection::flushBuffers()
|
||||
if(!enableBufferedWrite)
|
||||
return;
|
||||
|
||||
if (!socket)
|
||||
throw std::runtime_error("Can't write to closed socket!");
|
||||
|
||||
try
|
||||
{
|
||||
asio::write(*socket, connectionBuffers->writeBuffer);
|
||||
@@ -164,6 +167,9 @@ void CConnection::flushBuffers()
|
||||
|
||||
int CConnection::write(const void * data, unsigned size)
|
||||
{
|
||||
if (!socket)
|
||||
throw std::runtime_error("Can't write to closed socket!");
|
||||
|
||||
try
|
||||
{
|
||||
if(enableBufferedWrite)
|
||||
|
Reference in New Issue
Block a user