diff options
| author | Petr Mrázek | 2012-03-11 23:07:38 +0100 |
|---|---|---|
| committer | Petr Mrázek | 2012-03-11 23:07:38 +0100 |
| commit | db93b548db812056d4bf02ce487fe76831a8547c (patch) | |
| tree | 9e4b494b63e86cd21e2b0a89041a394c21c26776 /library/PluginManager.cpp | |
| parent | 68fbb535c917c27ac8f359f0c501d73e3fbb179e (diff) | |
| download | dfhack-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.cpp | 6 |
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... |
