ExtensionSystem: fix crash on git interactive rebase

Luas LuaPluginSpec::plugin() returns a nullptr so we have to check the
usages of PluginSpec::plugin before using it.

Change-Id: If4fa926814e5a418e446d6970bb46060feec5664
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
David Schulz
2024-05-02 15:11:33 +02:00
parent 8af9417181
commit b7dff8b636

View File

@@ -641,14 +641,16 @@ void PluginManager::remoteArguments(const QString &serializedArgument, QObject *
for (const PluginSpec *ps : plugins()) { for (const PluginSpec *ps : plugins()) {
if (ps->state() == PluginSpec::Running) { if (ps->state() == PluginSpec::Running) {
const QStringList pluginOptions = subList(serializedArguments, QLatin1Char(':') + ps->name()); const QStringList pluginOptions = subList(serializedArguments, QLatin1Char(':') + ps->name());
QObject *socketParent = ps->plugin()->remoteCommand(pluginOptions, workingDirectory, if (IPlugin *plugin = ps->plugin()) {
arguments); QObject *socketParent
= plugin->remoteCommand(pluginOptions, workingDirectory, arguments);
if (socketParent && socket) { if (socketParent && socket) {
socket->setParent(socketParent); socket->setParent(socketParent);
socket = nullptr; socket = nullptr;
} }
} }
} }
}
if (socket) if (socket)
delete socket; delete socket;
} }