From fb5e83a69b86ec76ccd2b321d0628fc15e00b46c Mon Sep 17 00:00:00 2001 From: Carson McDonald Date: Sun, 17 Feb 2013 07:23:32 -0500 Subject: Fix crash when exiting mirb using ctrl-d when compiled with readline support. --- tools/mirb/mirb.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools') diff --git a/tools/mirb/mirb.c b/tools/mirb/mirb.c index 85c3249d2..29685cf28 100644 --- a/tools/mirb/mirb.c +++ b/tools/mirb/mirb.c @@ -191,6 +191,10 @@ main(void) last_code_line[char_index] = '\0'; #else char* line = readline(code_block_open ? "* " : "> "); + if(line == NULL) { + printf("\n"); + break; + } strncat(last_code_line, line, sizeof(last_code_line)-1); add_history(line); free(line); -- cgit v1.2.3