summaryrefslogtreecommitdiff
path: root/Userland/DevTools
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-03-01 22:56:58 +0200
committerAndreas Kling <kling@serenityos.org>2021-03-02 13:37:26 +0100
commit05c48cc8d8d7fb5072a7c09026770d61c61a0d1a (patch)
treef8650ff82d2ef9e7f6e40521992da2ea45214e0b /Userland/DevTools
parent0e881bc5d723578cf09d4db61e93cb5405b8c983 (diff)
downloadserenity-05c48cc8d8d7fb5072a7c09026770d61c61a0d1a.zip
LanguageServers/Cpp: Fix nullptr dereference in ~LanguageClient
The WeakPtr to the ServerConnection is nullified if the server crashes. Closes #5570.
Diffstat (limited to 'Userland/DevTools')
-rw-r--r--Userland/DevTools/HackStudio/LanguageClient.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/DevTools/HackStudio/LanguageClient.h b/Userland/DevTools/HackStudio/LanguageClient.h
index f7bedc2c55..b9b233f028 100644
--- a/Userland/DevTools/HackStudio/LanguageClient.h
+++ b/Userland/DevTools/HackStudio/LanguageClient.h
@@ -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);