aboutsummaryrefslogtreecommitdiff
path: root/demo.c
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2008-10-09 22:41:07 +0100
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2008-10-09 22:41:07 +0100
commit247fae6a72dde255ee2a23eb1e3eb1bd7a466ed0 (patch)
tree45cef121611681b7194702f1420c38eacca81c0f /demo.c
parent05639c477367fa436ef33a0a4dc5fc37215acd94 (diff)
downloadtermo-247fae6a72dde255ee2a23eb1e3eb1bd7a466ed0.tar.gz
termo-247fae6a72dde255ee2a23eb1e3eb1bd7a466ed0.tar.xz
termo-247fae6a72dde255ee2a23eb1e3eb1bd7a466ed0.zip
Gracefully handle constructor failure rather than SEGV
Diffstat (limited to 'demo.c')
-rw-r--r--demo.c5
1 files changed, 5 insertions, 0 deletions
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;