libeval_compiler: fix crash when preflighting method calls with 0 arguments

This commit is contained in:
Tomasz Wlostowski 2020-08-27 14:52:01 +02:00
parent 8a5297180e
commit 712215fe12
1 changed files with 10 additions and 4 deletions

View File

@ -805,11 +805,17 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
if( func )
{
// Preflight the function call
wxString paramStr = *node->leaf[1]->leaf[1]->value.str;
VALUE* param = aPreflightContext->AllocValue();
auto argsLeaf = node->leaf[1]->leaf[1];
wxString paramStr;
param->Set( paramStr );
aPreflightContext->Push( param );
if( argsLeaf->op != TR_NULL ) // function has an argument
{
paramStr = *node->leaf[1]->leaf[1]->value.str;
VALUE* param = aPreflightContext->AllocValue();
param->Set( paramStr );
aPreflightContext->Push( param );
}
aPreflightContext->SetErrorCallback(
[&]( const wxString& aMessage, int aOffset )