Debugger: Fix reading empty lines

This commit is contained in:
Jeffrey Pfau 2016-10-30 02:50:58 -07:00
parent e66061ed9e
commit 40c6304cf0
1 changed files with 7 additions and 3 deletions

View File

@ -76,9 +76,13 @@ const char* _CLIDebuggerEditLineReadLine(struct CLIDebuggerBackend* be, size_t*
int count;
*len = 0;
const char* line = el_gets(elbe->elstate, &count);
if (line && count >= 1) {
// Crop off newline
*len = (size_t) count - 1;
if (line) {
if (count > 1) {
// Crop off newline
*len = (size_t) count - 1;
} else if (count == 1) {
*len = 1;
}
}
return line;
}