LanguageClient: add asserts and early returns for null clients

Change-Id: I6f972dbe931e27b2d30b048b413e95aea1fca282
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2025-04-09 09:24:57 +02:00
parent f4dc189d9b
commit 3d7b75a352
2 changed files with 3 additions and 1 deletions

View File

@@ -660,7 +660,8 @@ void LanguageClientManager::documentOpened(Core::IDocument *document)
clients.removeAll(clientForProject);
}
} else if (setting->m_startBehavior == BaseSettings::RequiresFile && clients.isEmpty()) {
clients << startClient(setting);
if (Client *client = startClient(setting); QTC_GUARD(client))
clients << client;
}
allClients << clients;
}

View File

@@ -618,6 +618,7 @@ Client *BaseSettings::createClient(ProjectExplorer::Project *project) const
BaseClientInterface *interface = createInterface(project);
QTC_ASSERT(interface, return nullptr);
auto *client = createClient(interface);
QTC_ASSERT(client, return nullptr);
if (client->name().isEmpty())
client->setName(Utils::globalMacroExpander()->expand(m_name));