Don't call exit(), but return nullptr.
This commit is contained in:
parent
b31588bfab
commit
696db7de39
@ -46,7 +46,7 @@ hwinf *Update::loadDCPlugin(QDir const &plugInDir, QString const &fname) {
|
||||
qCritical() << "in directory" << plugInDir.absolutePath();
|
||||
qCritical() << "cannot load plugin" << pluginLoader.fileName();
|
||||
qCritical() << pluginLoader.errorString();
|
||||
exit(-1);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
qCritical() << "loadDCPlugin() plugin directory:" << plugInDir.absolutePath();
|
||||
@ -54,25 +54,25 @@ hwinf *Update::loadDCPlugin(QDir const &plugInDir, QString const &fname) {
|
||||
|
||||
if (!pluginLoader.isLoaded()) {
|
||||
qCritical() << pluginLoader.errorString();
|
||||
exit(-2);
|
||||
return nullptr;
|
||||
}
|
||||
QObject *plugin = pluginLoader.instance();
|
||||
if (!plugin) {
|
||||
qCritical() << "cannot start instance";
|
||||
exit(-3);
|
||||
return nullptr;
|
||||
}
|
||||
if (! (hw = qobject_cast<hwinf *>(plugin))) {
|
||||
qCritical() << "cannot cast plugin" << plugin << "to hwinf";
|
||||
exit(-4);
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
qCritical() << pluginLibName << "does not exist";
|
||||
exit(-5);
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
qCritical() << "plugins directory" << plugInDir.absolutePath()
|
||||
<< "does not exist";
|
||||
exit(-6);
|
||||
return nullptr;
|
||||
}
|
||||
return hw;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user