diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-08-25 20:34:45 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-08-25 20:38:15 +0200 |
commit | 58450742953e8782c546a42ab541d601c6abc856 (patch) | |
tree | b2a057fa9ed849c466410b8a4906264c8e1722e0 | |
parent | d63d8b6f0c0a43a14de9493f1683a209a0166889 (diff) |
eval.c: fix segfault when attempting to resolve invalid lhs
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | eval.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -317,7 +317,7 @@ ut_getref_required(struct ut_state *state, struct ut_opcode *op, struct json_obj if (!json_object_is_type(scope, json_type_array) && !json_object_is_type(scope, json_type_object)) { - lhs = ut_ref_to_str(op->operand[0]); + lhs = op->operand[0] ? ut_ref_to_str(op->operand[0]) : NULL; if (lhs) { rv = ut_exception(state, op->operand[0], "Type error: %s is null", lhs); @@ -325,9 +325,8 @@ ut_getref_required(struct ut_state *state, struct ut_opcode *op, struct json_obj free(lhs); } else { - rv = ut_exception(state, op->operand[0], - "Syntax error: Invalid left-hand side operand %s for %s", - tokennames[op->operand[0]->type], tokennames[op->type]); + rv = ut_exception(state, op, + "Syntax error: Invalid left-hand side operand %s", tokennames[op->type]); } *key = NULL; |