Fix destructors not being called when program execution ended, closes #859

dev-buzzingcars
krzys-h 2016-11-11 23:07:22 +01:00
parent b49fbf0cd6
commit 7190c8518e
1 changed files with 2 additions and 2 deletions

View File

@ -200,16 +200,16 @@ bool CBotProgram::Run(void* pUser, int timer)
}
// completed on a mistake?
if (!ok && !m_stack->IsOk())
if (ok || !m_stack->IsOk())
{
m_error = m_stack->GetError(m_errorStart, m_errorEnd);
m_stack->Delete();
m_stack = nullptr;
CBotClass::FreeLock(this);
m_entryPoint = nullptr;
return true; // execution is finished!
}
if ( ok ) m_entryPoint = nullptr; // more function in execution
return ok;
}