summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorCarson McDonald <[email protected]>2013-02-17 07:23:32 -0500
committerCarson McDonald <[email protected]>2013-02-17 07:23:32 -0500
commitfb5e83a69b86ec76ccd2b321d0628fc15e00b46c (patch)
treeaeb41768bb34d44f4b67ddc69e58109d933c3cf2 /tools
parent92cf2a0ced00cf4071d624eb2d842867a6d054c2 (diff)
downloadmruby-fb5e83a69b86ec76ccd2b321d0628fc15e00b46c.tar.gz
mruby-fb5e83a69b86ec76ccd2b321d0628fc15e00b46c.zip
Fix crash when exiting mirb using ctrl-d when compiled with readline
support.
Diffstat (limited to 'tools')
-rw-r--r--tools/mirb/mirb.c4
1 files changed, 4 insertions, 0 deletions
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);