getkey_simple() should return TERMKEY_RES_NONE if no bytes available; as a safety check

This commit is contained in:
Paul LeoNerd Evans 2008-11-09 19:29:30 +00:00
parent 0483eacb68
commit de74ffa67f
1 changed files with 3 additions and 0 deletions

View File

@ -359,6 +359,9 @@ static void emit_codepoint(termkey_t *tk, long codepoint, termkey_key *key)
static termkey_result getkey_simple(termkey_t *tk, termkey_key *key, int force)
{
if(tk->buffcount == 0)
return tk->is_closed ? TERMKEY_RES_EOF : TERMKEY_RES_NONE;
unsigned char b0 = CHARAT(0);
if(b0 == 0x1b) {