~brenns10/funlisp

fa5b46ec1e76540a16c498962e338847ace7e1d1 — Stephen Brennan 3 years ago f535539
Fix segfault on empty input line in repl
1 files changed, 4 insertions(+), 3 deletions(-)

M tools/repl.c
M tools/repl.c => tools/repl.c +4 -3
@@ 20,12 20,13 @@ int main(int argc, char **argv)

	for (;;) {
		char *input = readline("> ");
		if (input == NULL) {
			break;
		}
		if (input == NULL)
			break; /* Ctrl-D, EOF */
		lisp_value *value = lisp_parse(rt, input);
		add_history(input);
		free(input);
		if (!value)
			continue; /* blank line */
		lisp_value *result = lisp_eval(rt, scope, value);
		lisp_print(stdout, result);
		fprintf(stdout, "\n");