From de74ffa67f91b4b3415eabd54ae9a2c931a88a1b Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Sun, 9 Nov 2008 19:29:30 +0000 Subject: [PATCH] getkey_simple() should return TERMKEY_RES_NONE if no bytes available; as a safety check --- termkey.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/termkey.c b/termkey.c index 4e0b1ea..e36d174 100644 --- a/termkey.c +++ b/termkey.c @@ -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) {