summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-01 11:11:43 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-01 11:11:43 +0100
commitb028dda3593598ab7664c2d70846c50405b534ad (patch)
treeb2fd4636ef143c78d31686b27e0d0d67c51c331a
parente16340f2dba2df4e997a0f4f03b197cc814ab9fa (diff)
Return from getCallback if there is no reply
-rw-r--r--Makefile4
-rw-r--r--example-libev.c1
-rw-r--r--example-libevent.c1
3 files changed, 4 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 7efebe0..427e74f 100644
--- a/Makefile
+++ b/Makefile
@@ -58,10 +58,10 @@ dynamic: ${DYLIBNAME}
static: ${STLIBNAME}
# Binaries:
-hiredis-example-libevent: ${DYLIBNAME}
+hiredis-example-libevent: example-libevent.o ${DYLIBNAME}
$(CC) -o $@ $(CCOPT) $(DEBUG) -L. -lhiredis -levent -Wl,-rpath,. example-libevent.c
-hiredis-example-libev: ${DYLIBNAME}
+hiredis-example-libev: example-libev.o ${DYLIBNAME}
$(CC) -o $@ $(CCOPT) $(DEBUG) -L. -lhiredis -lev -Wl,-rpath,. example-libev.c
hiredis-%: %.o ${DYLIBNAME}
diff --git a/example-libev.c b/example-libev.c
index 3495b2f..709c9ea 100644
--- a/example-libev.c
+++ b/example-libev.c
@@ -7,6 +7,7 @@
#include "adapters/libev.h"
void getCallback(redisAsyncContext *c, redisReply *reply, void *privdata) {
+ if (reply == NULL) return;
printf("argv[%s]: %s\n", (char*)privdata, reply->str);
/* Disconnect after receiving the reply to GET */
diff --git a/example-libevent.c b/example-libevent.c
index 101fa71..65dffe6 100644
--- a/example-libevent.c
+++ b/example-libevent.c
@@ -7,6 +7,7 @@
#include "adapters/libevent.h"
void getCallback(redisAsyncContext *c, redisReply *reply, void *privdata) {
+ if (reply == NULL) return;
printf("argv[%s]: %s\n", (char*)privdata, reply->str);
/* Disconnect after receiving the reply to GET */