aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-07-29 17:09:53 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-07-29 17:09:53 +0200
commit0d07fa5da9f4c287410ce68d9d89da5c436fcc68 (patch)
treea97a04fb1c6e5a603c4fc92c1451b4d18a1266be
parentbd8546c49594fddb4a41b5eb5bd82719c3c5e4f1 (diff)
clientlib: Fix behaviour for zero history
-rw-r--r--ssh/tomsg_clientlib.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ssh/tomsg_clientlib.c b/ssh/tomsg_clientlib.c
index adcb4ee..e6d3684 100644
--- a/ssh/tomsg_clientlib.c
+++ b/ssh/tomsg_clientlib.c
@@ -815,6 +815,11 @@ static enum tomsg_retval handle_line(
inflight.event.history.messages = calloc(count, sizeof(struct history_message));
if (!inflight.event.history.messages) CLEANUP_RETURN(TOMSG_ERR_MEMORY);
+ // If there are no history_message's coming, complete early
+ if (count == 0) {
+ SUCCESS_RETURN();
+ }
+
// Re-add the tag for the history_message events
enum tomsg_retval ret = add_inflight(client, tag, inflight.event);
if (ret != TOMSG_OK) return ret;