Commit f3fa4557 authored by Sébastien Le Stum's avatar Sébastien Le Stum Committed by Sébastien Blin

plugin: prevent potential nullptr dereference

Remove potential NULL pointer dereference in the case of plugin
pointer being NULL.

Change-Id: Iaf7fd6c4d0c44983723827dbba89f18136c8954a
parent 0369159e
......@@ -184,15 +184,15 @@ PluginManager::registerPlugin(std::unique_ptr<Plugin>& plugin)
*/
pluginPtr->api_.manageComponent = [](const JAMI_PluginAPI* api, const char* name, void* data) {
auto plugin = static_cast<DLPlugin*>(api->context);
if (!plugin) {
JAMI_ERR() << "createComponent called with null context";
return -1;
}
auto manager = reinterpret_cast<PluginManager*>(plugin->apiContext_);
if (!manager) {
JAMI_ERR() << "createComponent called with null plugin API";
return -1;
} else if (!plugin) {
JAMI_ERR() << "createComponent called with null context";
return -1;
}
return manager->manageComponent(plugin, name, data);
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment