py/parse: When looking up consts, check they exist before checking type.

This commit is contained in:
Damien George 2016-03-19 21:36:32 +00:00
parent 2b302dad51
commit 8d4d6731f5

View File

@ -620,7 +620,7 @@ STATIC bool fold_constants(parser_t *parser, const rule_t *rule, size_t num_args
} }
mp_obj_t dest[2]; mp_obj_t dest[2];
mp_load_method_maybe(elem->value, q_attr, dest); mp_load_method_maybe(elem->value, q_attr, dest);
if (!(MP_OBJ_IS_INT(dest[0]) && dest[1] == MP_OBJ_NULL)) { if (!(dest[0] != MP_OBJ_NULL && MP_OBJ_IS_INT(dest[0]) && dest[1] == MP_OBJ_NULL)) {
return false; return false;
} }
arg0 = dest[0]; arg0 = dest[0];