From 247fae6a72dde255ee2a23eb1e3eb1bd7a466ed0 Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Thu, 9 Oct 2008 22:41:07 +0100 Subject: Gracefully handle constructor failure rather than SEGV --- demo.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/demo.c b/demo.c index 6e635ca..96e2d24 100644 --- a/demo.c +++ b/demo.c @@ -6,6 +6,11 @@ int main(int argc, char *argv[]) { char buffer[50]; termkey_t *tk = termkey_new(0, 0); + if(!tk) { + fprintf(stderr, "Cannot allocate termkey instance\n"); + exit(1); + } + termkey_result ret; termkey_key key; -- cgit v1.2.3-70-g09d2