From: Sage Weil Date: Sat, 22 Jul 2017 03:31:55 +0000 (-0400) Subject: mon: do not dereference empty mgr_commands X-Git-Tag: v12.1.2~160^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c1704f2e6be8b0582bffc54e0adc505e0876fca5;p=ceph.git mon: do not dereference empty mgr_commands This may be empty before the initial quorum commits the static command list. Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 9ec308d7832a..7595018df10e 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3013,8 +3013,10 @@ void Monitor::handle_command(MonOpRequestRef op) const MonCommand *leader_cmd; const auto& mgr_cmds = mgrmon()->get_command_descs(); - const MonCommand *mgr_cmd = _get_moncommand(prefix, &mgr_cmds.at(0), - mgr_cmds.size()); + const MonCommand *mgr_cmd = nullptr; + if (!mgr_cmds.empty()) { + mgr_cmd = _get_moncommand(prefix, &mgr_cmds.at(0), mgr_cmds.size()); + } leader_cmd = _get_moncommand(prefix, // the boost underlying this isn't const for some reason const_cast(leader_supported_mon_commands),