mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix crash when exiting mirb using ctrl-d when compiled with readline
support.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user