From 6c3397fac8300afe55be4007faea932771c85199 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Sat, 16 Dec 2017 15:19:00 -0700 Subject: [PATCH] Fix crash when calling a member function that doesn't exist. Fixes #260. --- src/engine/compile.c | 2 +- src/engine/function.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/engine/compile.c b/src/engine/compile.c index 6adb83fa2..6ebb4006c 100644 --- a/src/engine/compile.c +++ b/src/engine/compile.c @@ -99,7 +99,7 @@ LIST * evaluate_rule( RULE * rule, OBJECT * rulename, FRAME * frame ) /* Check traditional targets $(<) and sources $(>). */ if ( !rule->actions && !rule->procedure ) - unknown_rule( frame, NULL, frame->module, rule->name ); + unknown_rule( frame, NULL, frame->module, rulename ); /* If this rule will be executed for updating the targets then construct the * action for make(). diff --git a/src/engine/function.c b/src/engine/function.c index d426f5386..2244c3e30 100644 --- a/src/engine/function.c +++ b/src/engine/function.c @@ -533,7 +533,20 @@ static LIST * function_call_member_rule( JAM_FUNCTION * function, FRAME * frame, if ( module->class_module ) { rule = bindrule( rulename, module ); - real_rulename = object_copy( function_rulename( rule->procedure ) ); + if ( rule->procedure ) + { + real_rulename = object_copy( function_rulename( rule->procedure ) ); + } + else + { + string buf[ 1 ]; + string_new( buf ); + string_append( buf, object_str( module->name ) ); + string_push_back( buf, '.' ); + string_append( buf, object_str( rulename ) ); + real_rulename = object_new( buf->value ); + string_free( buf ); + } } else {