fixed a bug of not checking if the current script is null for @SCRIPTNAME in parse.c

This commit is contained in:
hyung-hwan 2020-11-07 01:51:52 +00:00
parent fe600c2ce4
commit a532d65335

View File

@ -6691,7 +6691,7 @@ retry:
if (hawk_comp_oochars_bcstr(HAWK_OOECS_PTR(tok->name), HAWK_OOECS_LEN(tok->name), "@SCRIPTNAME") == 0) if (hawk_comp_oochars_bcstr(HAWK_OOECS_PTR(tok->name), HAWK_OOECS_LEN(tok->name), "@SCRIPTNAME") == 0)
{ {
/* special parser-level word @SCRIPTNAME. substitute an actual value for it */ /* special parser-level word @SCRIPTNAME. substitute an actual value for it */
if (HAWK_UNLIKELY(hawk_ooecs_cpy(tok->name, tok->loc.file) == (hawk_oow_t)-1)) return -1; if (HAWK_UNLIKELY(hawk_ooecs_cpy(tok->name, (tok->loc.file? tok->loc.file: HAWK_T(""))) == (hawk_oow_t)-1)) return -1;
SET_TOKEN_TYPE (hawk, tok, TOK_STR); SET_TOKEN_TYPE (hawk, tok, TOK_STR);
} }
else if (hawk_comp_oochars_bcstr(HAWK_OOECS_PTR(tok->name), HAWK_OOECS_LEN(tok->name), "@SCRIPTLINE") == 0) else if (hawk_comp_oochars_bcstr(HAWK_OOECS_PTR(tok->name), HAWK_OOECS_LEN(tok->name), "@SCRIPTLINE") == 0)