I'm seeing an assert trigger in the following situation:
CScriptArray* MyFunction(const std::string& name, MyAppType* foo)
{
asIObjectType* objectType = ...;
if ( name.empty() )
{
asGetActiveContext()->SetException("Please provide a non-empty name");
CScriptArray* scriptArray = CScriptArray::Create(objectType);
assert( NULL != scriptArray ); // this asserts
return scriptArray;
}
...
}
What I'd prefer is that the function returns, but then I see my script exception (via whatever means I'm using to catch/display them).
If I allocate the array first, and then set the exception, there is no assert:
CScriptArray* MyFunction(const std::string& name, MyAppType* foo)
{
asIObjectType* objectType = ...;
if ( name.empty() )
{
CScriptArray* scriptArray = CScriptArray::Create(objectType);
assert( NULL != scriptArray ); // this does not assert
asGetActiveContext()->SetException("Please provide a non-empty name");
return scriptArray;
}
...
}
I can easily work around this (perhaps I should be returning NULL anyway since I've already set the script exception..) but FYI.