Fix crash on script error outside function [Knueppel-crash]

alut-include-path
Sven Eberhardt 2017-02-20 18:45:11 -05:00
parent ca19504c40
commit 198d11427d
1 changed files with 4 additions and 1 deletions

View File

@ -228,7 +228,10 @@ class C4AulCompiler::CodegenAstVisitor : public ::aul::DefaultRecursiveVisitor
void HandleError(const C4AulError &e)
{
AddBCC(nullptr, AB_ERR, (intptr_t)::Strings.RegString(e.what()));
if (Fn)
{
AddBCC(nullptr, AB_ERR, (intptr_t)::Strings.RegString(e.what()));
}
if (target_host) // target_host may be nullptr for DirectExec scripts
{
target_host->Engine->ErrorHandler->OnError(e.what());