Commit e335d5211faceff02104fcd0e908554053624fee

Con Kolivas 2011-07-13T09:59:02

Cope with servers that return empty bodies that would otherwise crash jansson.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/util.c b/util.c
index f596ad5..687aabc 100644
--- a/util.c
+++ b/util.c
@@ -284,6 +284,12 @@ json_t *json_rpc_call(CURL *curl, const char *url,
 		goto err_out;
 	}
 
+	if (!all_data.buf) {
+		if (opt_debug)
+			applog(LOG_DEBUG, "Empty data received in json_rpc_call.");
+		goto err_out;
+	}
+
 	/* If X-Long-Polling was found, activate long polling */
 	if (hi.lp_path) {
 		have_longpoll = true;