0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd::mods: Paranoid checks after load.

This commit is contained in:
Jason Volk 2019-02-28 15:51:44 -08:00
parent fbbbb38e75
commit c90d05a878

View file

@ -828,12 +828,19 @@ try
std::make_shared<mod>(std::move(path), flags)
};
assert(ret);
assert(ret->header);
assert(ret->header->meta);
if(!ret || !ret->header)
throw panic
{
"Unknown module error."
};
// Call the user-supplied init function well after fully loading and
// construction of the module. This way the init function sees the module
// as loaded and can make shared_ptr references, etc.
assert(ret->header);
assert(ret->header->meta);
if(ret->header->meta->init)
if(ret->header->meta && ret->header->meta->init)
ret->header->meta->init();
log::info