checking for NULLs before checking exceptions

This commit is contained in:
Alex Shinn 2013-04-05 19:55:36 +09:00
parent 0f723c17ea
commit 7c1c40fb07
2 changed files with 2 additions and 2 deletions

2
eval.c
View file

@ -51,7 +51,7 @@ void sexp_warn (sexp ctx, char *msg, sexp x) {
} }
sexp sexp_warn_undefs_op (sexp ctx, sexp self, sexp_sint_t n, sexp from, sexp to, sexp res) { sexp sexp_warn_undefs_op (sexp ctx, sexp self, sexp_sint_t n, sexp from, sexp to, sexp res) {
sexp x, ignore = sexp_exceptionp(res) ? sexp_exception_irritants(res) : SEXP_NULL; sexp x, ignore = (res && sexp_exceptionp(res)) ? sexp_exception_irritants(res) : SEXP_NULL;
if (sexp_envp(from)) from = sexp_env_bindings(from); if (sexp_envp(from)) from = sexp_env_bindings(from);
for (x=from; sexp_pairp(x) && x!=to; x=sexp_env_next_cell(x)) for (x=from; sexp_pairp(x) && x!=to; x=sexp_env_next_cell(x))
if (sexp_cdr(x) == SEXP_UNDEF && sexp_car(x) != ignore if (sexp_cdr(x) == SEXP_UNDEF && sexp_car(x) != ignore

2
main.c
View file

@ -205,7 +205,7 @@ static void repl (sexp ctx, sexp env) {
#if SEXP_USE_WARN_UNDEFS #if SEXP_USE_WARN_UNDEFS
sexp_warn_undefs(ctx, sexp_env_bindings(env), tmp, res); sexp_warn_undefs(ctx, sexp_env_bindings(env), tmp, res);
#endif #endif
if (sexp_exceptionp(res)) { if (res && sexp_exceptionp(res)) {
sexp_print_exception(ctx, res, err); sexp_print_exception(ctx, res, err);
sexp_stack_trace(ctx, err); sexp_stack_trace(ctx, err);
} else if (res != SEXP_VOID) { } else if (res != SEXP_VOID) {