Fix crash disabling extensions

This commit is contained in:
David Capello 2020-04-20 14:11:48 -03:00
parent 1f34d0e46e
commit ff3e9504fd

View File

@ -226,6 +226,9 @@ Extension::Extension(const std::string& path,
, m_isInstalled(true) , m_isInstalled(true)
, m_isBuiltinExtension(isBuiltinExtension) , m_isBuiltinExtension(isBuiltinExtension)
{ {
#ifdef ENABLE_SCRIPTING
m_plugin.pluginRef = LUA_REFNIL;
#endif
} }
Extension::~Extension() Extension::~Extension()
@ -326,12 +329,14 @@ void Extension::enable(const bool state)
m_isEnabled = state; m_isEnabled = state;
#ifdef ENABLE_SCRIPTING #ifdef ENABLE_SCRIPTING
if (hasScripts()) {
if (m_isEnabled) { if (m_isEnabled) {
initScripts(); initScripts();
} }
else { else {
exitScripts(); exitScripts();
} }
}
#endif // ENABLE_SCRIPTING #endif // ENABLE_SCRIPTING
} }