Clean up AngelScript context on exception.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-04-06 20:06:43 +02:00
parent 48ef465c82
commit 1046eceacf
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 10 additions and 0 deletions

View File

@ -53,8 +53,18 @@ public:
std::stringstream err; \
err << "Script exception in script '" << GetName().c_str() << "', line " << ctx->GetExceptionLineNumber() \
<< ". Message: '" << ctx->GetExceptionString() << "'."; \
if (newContext) { \
_ctxPool->ReturnContextToPool(ctx); \
} else { \
ctx->PopState(); \
} \
throw CreatureException(err.str()); \
} \
if (newContext) { \
_ctxPool->ReturnContextToPool(ctx); \
} else { \
ctx->PopState(); \
} \
throw CreatureException("Script didn't finish properly; message " + std::to_string(scriptResult)); \
} \
if (newContext) { \