1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +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:
Itamar 2021-03-01 22:56:58 +02:00 committed by Andreas Kling
parent 0e881bc5d7
commit 05c48cc8d8

View file

@ -112,7 +112,10 @@ public:
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);
if (m_previous_client)
m_server_connection->attach(*m_previous_client);