mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-07 00:46:33 +02:00
Fix crash when the constructor of a LuaComponent derivative fails
The interface API is a mess, hopefully not for long.
This commit is contained in:
@@ -18,7 +18,7 @@ int LuaComponentCallback::CheckAndAssignArg1(lua_State *l)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LuaComponent::LuaComponent(lua_State * l) : owner_ref(LUA_REFNIL)
|
LuaComponent::LuaComponent(lua_State * l) : component(nullptr), owner_ref(LUA_REFNIL)
|
||||||
{
|
{
|
||||||
this->l = l; // I don't get how this doesn't cause crashes later on
|
this->l = l; // I don't get how this doesn't cause crashes later on
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ int LuaComponent::visible(lua_State * l)
|
|||||||
|
|
||||||
LuaComponent::~LuaComponent()
|
LuaComponent::~LuaComponent()
|
||||||
{
|
{
|
||||||
if(component->GetParentWindow())
|
if(component && component->GetParentWindow())
|
||||||
component->GetParentWindow()->RemoveComponent(component);
|
component->GetParentWindow()->RemoveComponent(component);
|
||||||
delete component;
|
delete component;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user