diff options
author | Itamar <itamar8910@gmail.com> | 2021-03-01 22:56:58 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-02 13:37:26 +0100 |
commit | 05c48cc8d8d7fb5072a7c09026770d61c61a0d1a (patch) | |
tree | f8650ff82d2ef9e7f6e40521992da2ea45214e0b /Userland/DevTools | |
parent | 0e881bc5d723578cf09d4db61e93cb5405b8c983 (diff) | |
download | serenity-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.h | 5 |
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); |