# HG changeset patch # User PrasannaKumar Muralidharan # Date 1384066574 -19800 # Sun Nov 10 12:26:14 2013 +0530 # Node ID 5328d184845f79278a03cb7a67a95ca8a1c33a5f # Parent 1d109119ac71fe075db46901ea490d9ccb95b6a6 Fix null pointer access in octave_fcn_binder::maybe_binder diff -r 1d109119ac71 -r 5328d184845f libinterp/octave-value/ov-fcn-handle.cc --- a/libinterp/octave-value/ov-fcn-handle.cc Fri Nov 08 08:31:09 2013 -0800 +++ b/libinterp/octave-value/ov-fcn-handle.cc Sun Nov 10 12:26:14 2013 +0530 @@ -1884,12 +1884,19 @@ octave_user_function *usr_fcn = f.user_function_value (false); tree_parameter_list *param_list = usr_fcn ? usr_fcn->parameter_list () : 0; - // Verify that the body is a single expression (always true in theory). + tree_statement_list *cmd_list = NULL; + tree_expression *body_expr = NULL; - tree_statement_list *cmd_list = usr_fcn ? usr_fcn->body () : 0; - tree_expression *body_expr = (cmd_list->length () == 1 + if (usr_fcn) + { + cmd_list = usr_fcn->body (); + if (cmd_list) + { + // Verify that the body is a single expression (always true in theory). + body_expr = (cmd_list->length () == 1 ? cmd_list->front ()->expression () : 0); - + } + } if (body_expr && body_expr->is_index_expression () && ! (param_list && param_list->takes_varargs ()))