diff --git a/core/systems/ExtensionSys.cpp b/core/systems/ExtensionSys.cpp index e8daca49..a5f8b8db 100644 --- a/core/systems/ExtensionSys.cpp +++ b/core/systems/ExtensionSys.cpp @@ -933,9 +933,6 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt) } } - /* Tell it to unload */ - pAPI = pExt->GetAPI(); - pAPI->OnExtensionUnload(); } IdentityToken_t *pIdentity; @@ -949,6 +946,12 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt) } } + /* Tell it to unload */ + if (pExt->IsLoaded()) + { + IExtensionInterface *pAPI = pExt->GetAPI(); + pAPI->OnExtensionUnload(); + } pExt->Unload(); delete pExt;