mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:57:34 +00:00
LanguageServers/Cpp: Fix nullptr dereference in ~LanguageClient
The WeakPtr to the ServerConnection is nullified if the server crashes. Closes #5570.
This commit is contained in:
parent
0e881bc5d7
commit
05c48cc8d8
1 changed files with 4 additions and 1 deletions
|
@ -112,7 +112,10 @@ public:
|
||||||
|
|
||||||
virtual ~LanguageClient()
|
virtual ~LanguageClient()
|
||||||
{
|
{
|
||||||
m_server_connection->detach();
|
// m_server_connection is nullified if the server crashes
|
||||||
|
if (m_server_connection)
|
||||||
|
m_server_connection->detach();
|
||||||
|
|
||||||
VERIFY(m_previous_client.ptr() != this);
|
VERIFY(m_previous_client.ptr() != this);
|
||||||
if (m_previous_client)
|
if (m_previous_client)
|
||||||
m_server_connection->attach(*m_previous_client);
|
m_server_connection->attach(*m_previous_client);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue