From 77b6d2f32dbcf03d7119170949544966e9b71a9c Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Thu, 26 Apr 2018 19:33:01 -0400 Subject: [PATCH] Don't display "last_connection_attempt" if there is not one --- trp/trp_peer_encoders.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/trp/trp_peer_encoders.c b/trp/trp_peer_encoders.c index 8aafece..b169e17 100644 --- a/trp/trp_peer_encoders.c +++ b/trp/trp_peer_encoders.c @@ -64,15 +64,13 @@ static json_t *last_attempt_to_json_string(TRP_PEER *peer) char *s = NULL; json_t *jstr = NULL; - if (tr_cmp_timespec(trp_peer_get_last_conn_attempt(peer), &ts_zero) == 0) { - s = strdup(""); - } else { + if (tr_cmp_timespec(trp_peer_get_last_conn_attempt(peer), &ts_zero) > 0) { s = timespec_to_str(trp_peer_get_last_conn_attempt(peer)); - } - if (s) { - jstr = json_string(s); - free(s); + if (s) { + jstr = json_string(s); + free(s); + } } return jstr; -- 2.1.4