diff --git a/scp.c b/scp.c index e06ab8d0..3fa9b8a9 100644 --- a/scp.c +++ b/scp.c @@ -4941,12 +4941,12 @@ else { return sim_messagef (SCPE_ARG, "Invalid argument: %s\n", gbuf); } } -if (cond == SCPE_OK) - return sim_messagef (SCPE_ARG, "Invalid argument: %s\n", gbuf); if ((NULL == cptr) || ('\0' == *cptr)) { /* Empty Action */ free(sim_on_actions[sim_do_depth][cond]); /* Clear existing condition */ sim_on_actions[sim_do_depth][cond] = NULL; } else { + if ((cptr > sim_sub_instr_buf) && ((size_t)(cptr - sim_sub_instr_buf) < sim_sub_instr_size)) + cptr = &sim_sub_instr[sim_sub_instr_off[cptr - sim_sub_instr_buf]]; /* get un-substituted string */ sim_on_actions[sim_do_depth][cond] = (char *)realloc(sim_on_actions[sim_do_depth][cond], 1+strlen(cptr)); strcpy(sim_on_actions[sim_do_depth][cond], cptr);