summaryrefslogtreecommitdiff
path: root/library/PluginManager.cpp
diff options
context:
space:
mode:
authorPetr Mrázek2012-03-11 23:07:38 +0100
committerPetr Mrázek2012-03-11 23:07:38 +0100
commitdb93b548db812056d4bf02ce487fe76831a8547c (patch)
tree9e4b494b63e86cd21e2b0a89041a394c21c26776 /library/PluginManager.cpp
parent68fbb535c917c27ac8f359f0c501d73e3fbb179e (diff)
downloaddfhack-db93b548db812056d4bf02ce487fe76831a8547c.tar.gz
dfhack-db93b548db812056d4bf02ce487fe76831a8547c.tar.bz2
dfhack-db93b548db812056d4bf02ce487fe76831a8547c.tar.xz
Check for a valid plugin_shutdown function when unloading plugins
Fixes related segfault
Diffstat (limited to 'library/PluginManager.cpp')
-rw-r--r--library/PluginManager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp
index 824d7a23..d36ba665 100644
--- a/library/PluginManager.cpp
+++ b/library/PluginManager.cpp
@@ -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...