mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-31 09:57:14 +01:00
Make the audit stage optional.
Also fix bug where the execution function is not invoked without binding an audit function first which enables it.
This commit is contained in:
parent
47ff628a46
commit
cb0598d228
@ -400,16 +400,23 @@ int32_t Controller::Exec(Context & ctx)
|
|||||||
args = LightObj(arr.GetObj());
|
args = LightObj(arr.GetObj());
|
||||||
}
|
}
|
||||||
// Allow the user to audit the command parameters
|
// Allow the user to audit the command parameters
|
||||||
try
|
if (!ctx.mInstance->m_OnAudit.IsNull())
|
||||||
{
|
{
|
||||||
result = ctx.mInstance->Audit(ctx.mInvoker, args);
|
try
|
||||||
|
{
|
||||||
|
result = ctx.mInstance->Audit(ctx.mInvoker, args);
|
||||||
|
}
|
||||||
|
catch (const std::exception & e)
|
||||||
|
{
|
||||||
|
// Let's store the exception message
|
||||||
|
ctx.mBuffer.WriteS(0, e.what());
|
||||||
|
// Specify that the command execution failed
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (const std::exception & e)
|
else
|
||||||
{
|
{
|
||||||
// Let's store the exception message
|
result = SQTrue;
|
||||||
ctx.mBuffer.WriteS(0, e.what());
|
|
||||||
// Specify that the command execution failed
|
|
||||||
failed = true;
|
|
||||||
}
|
}
|
||||||
// Did parameter audit succeeded?
|
// Did parameter audit succeeded?
|
||||||
if (result && !failed)
|
if (result && !failed)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user