From 22f2f876f59c72520996daff7d68913e37ae005b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 26 Mar 2009 07:51:38 -0400 Subject: Let's not crash if we don't know the type of plugin --- sigtools/PluginLoader.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sigtools') 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(this); else if (type == "Canvas") plugin = factory->create(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"); -- cgit