Check for a valid plugin_shutdown function when unloading plugins

Fixes related segfault
develop
Petr Mrázek 2012-03-11 23:07:38 +01:00
parent 68fbb535c9
commit db93b548db
1 changed files with 4 additions and 2 deletions

@ -234,8 +234,10 @@ bool Plugin::unload()
// if we are actually loaded
if(state == PS_LOADED)
{
// notify plugin about shutdown
command_result cr = plugin_shutdown(con);
// notify plugin about shutdown, if it has a shutdown function
command_result cr = CR_OK;
if(plugin_shutdown)
cr = plugin_shutdown(con);
// wait for all calls to finish
access->wait();
// cleanup...