diff --git a/Core/gb.c b/Core/gb.c index 840c13e..7102f8f 100644 --- a/Core/gb.c +++ b/Core/gb.c @@ -97,9 +97,15 @@ static char *default_input_callback(GB_gameboy_t *gb) size_t size = 0; printf(">"); getline(&expression, &size, stdin); + if (!expression) { return strdup(""); } + + size_t length = strlen(expression); + if (expression[length - 1] == '\n') { + expression[length - 1] = 0; + } return expression; }