summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-12-08 15:30:24 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-12-08 15:30:24 +0300
commitd7db433ed83362cd9b4da2ff6582962995f87c41 (patch)
tree847eba07ca36e3ad7d52b72fc7f2785ef9759229 /src/mir_app
parent910c56f864415317b7863e64af47fe28af21fe4f (diff)
fix for a rare crash in Options - Plugins
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/newplugins.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp
index 234ec3e4f2..7407b444b2 100644
--- a/src/mir_app/src/newplugins.cpp
+++ b/src/mir_app/src/newplugins.cpp
@@ -265,21 +265,23 @@ bool Plugin_UnloadDyn(pluginEntry *p)
return true;
CMPluginBase *ppb = p->m_pPlugin;
- if (HINSTANCE hInst = ppb->getInst()) {
- if (CallPluginEventHook(hInst, hOkToExitEvent, 0, 0) != 0)
- return false;
+ if (ppb != nullptr) {
+ if (HINSTANCE hInst = ppb->getInst()) {
+ if (CallPluginEventHook(hInst, hOkToExitEvent, 0, 0) != 0)
+ return false;
- KillModuleAccounts(hInst);
- KillModuleSubclassing(hInst);
+ KillModuleAccounts(hInst);
+ KillModuleSubclassing(hInst);
- CallPluginEventHook(hInst, hPreShutdownEvent, 0, 0);
- CallPluginEventHook(hInst, hShutdownEvent, 0, 0);
+ CallPluginEventHook(hInst, hPreShutdownEvent, 0, 0);
+ CallPluginEventHook(hInst, hShutdownEvent, 0, 0);
- KillModuleEventHooks(hInst);
- KillModuleServices(hInst);
- }
+ KillModuleEventHooks(hInst);
+ KillModuleServices(hInst);
+ }
- NotifyFastHook(hevUnloadModule, (WPARAM)&ppb->getInfo(), (LPARAM)ppb->getInst());
+ NotifyFastHook(hevUnloadModule, (WPARAM)&ppb->getInfo(), (LPARAM)ppb->getInst());
+ }
// mark default plugins to be loaded
if (!p->bIsCore)