From 78b0bea1d6b56cbca725b376cc938cd6ca99164d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 6 Jun 2012 09:13:14 -0700 Subject: [PATCH] monclient: be paranoid/defensive about send_log vs log_client==NULL Signed-off-by: Sage Weil --- src/mon/MonClient.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 25b2ede161bd8..4bdf9f2941535 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -214,10 +214,12 @@ bool MonClient::ms_dispatch(Message *m) void MonClient::send_log() { - Message *lm = log_client->get_mon_log_message(); - if (lm) - _send_mon_message(lm); - more_log_pending = log_client->are_pending(); + if (log_client) { + Message *lm = log_client->get_mon_log_message(); + if (lm) + _send_mon_message(lm); + more_log_pending = log_client->are_pending(); + } } void MonClient::handle_monmap(MMonMap *m) @@ -527,8 +529,7 @@ void MonClient::tick() messenger->send_keepalive(cur_con); - if (state == MC_STATE_HAVE_SESSION && - log_client) { + if (state == MC_STATE_HAVE_SESSION) { send_log(); } } -- 2.39.5