From fc35635942e7324737451db862cf896341149c55 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 16 Sep 2021 14:42:03 +0200 Subject: [PATCH] LanguageClient: Fix possbible crash in inspector ... when clearing. Change-Id: Iadb57c07562fab77a65bcad38cf509dd1af6c0c3 Reviewed-by: David Schulz --- src/plugins/languageclient/lspinspector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/languageclient/lspinspector.cpp b/src/plugins/languageclient/lspinspector.cpp index 2a4912c81e9..933328b6b26 100644 --- a/src/plugins/languageclient/lspinspector.cpp +++ b/src/plugins/languageclient/lspinspector.cpp @@ -431,7 +431,8 @@ LspInspectorWidget::LspInspectorWidget(LspInspector *inspector) const auto clearButton = buttonBox->addButton(tr("Clear"), QDialogButtonBox::ResetRole); connect(clearButton, &QPushButton::clicked, this, [this] { m_inspector->clear(); - currentClientChanged(m_clients->currentItem()->text()); + if (m_clients->currentItem()) + currentClientChanged(m_clients->currentItem()->text()); }); mainLayout->addWidget(buttonBox); setLayout(mainLayout);