diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-03-26 07:51:38 -0400 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-03-26 07:51:38 -0400 |
commit | 22f2f876f59c72520996daff7d68913e37ae005b (patch) | |
tree | de3735fe92ea5bd63d4a871f8d61cba94e24ecbe /sigtools | |
parent | afae7c72743e47ddc8b8bec5b8a2e30f6dcedf20 (diff) | |
download | sigen-22f2f876f59c72520996daff7d68913e37ae005b.tar.gz sigen-22f2f876f59c72520996daff7d68913e37ae005b.tar.xz sigen-22f2f876f59c72520996daff7d68913e37ae005b.zip |
Let's not crash if we don't know the type of plugin
Diffstat (limited to 'sigtools')
-rw-r--r-- | sigtools/PluginLoader.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sigtools/PluginLoader.cpp b/sigtools/PluginLoader.cpp index 89656b28..44662a0e 100644 --- a/sigtools/PluginLoader.cpp +++ b/sigtools/PluginLoader.cpp @@ -91,16 +91,19 @@ void PluginLoader::Private::refresh(const QString& type) KPluginFactory *factory = loader.factory(); if (factory) { - PluginBase* plugin; + PluginBase* plugin = NULL; if (type == "Arena") plugin = factory->create<ArenaPlugin>(this); else if (type == "Canvas") plugin = factory->create<CanvasPlugin>(this); else KMessageBox::information(NULL, QString("The plugin type \"Sigen/%1\" is not supported.").arg(type), "Unsupported plugin type"); - QStringList classes = plugin->classList(); - foreach (const QString& className, classes) - m_available[type][className] = Service(service, plugin); + if (plugin) + { + QStringList classes = plugin->classList(); + foreach (const QString& className, classes) + m_available[type][className] = Service(service, plugin); + } } else KMessageBox::error(NULL, QString("The plugin of type \"Sigen/%1\" with name \"%2\" is not a valid Sigen plugin. The error was:\n%3").arg(type).arg(service->name()).arg(loader.errorString()), "Plugin loading error"); |