From: Sage Weil Date: Mon, 25 Jun 2018 21:00:02 +0000 (-0500) Subject: mgr/DaemonServer: avoid dereferencing end() iterator X-Git-Tag: v13.2.1~70^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F22805%2Fhead;p=ceph.git mgr/DaemonServer: avoid dereferencing end() iterator Fixes: http://tracker.ceph.com/issues/23249 Signed-off-by: Sage Weil (cherry picked from commit 97ef5a85100d3166910fc401465950c59a6664f1) --- diff --git a/src/mgr/DaemonServer.cc b/src/mgr/DaemonServer.cc index 421c87d8a6f4..437972eb46a1 100644 --- a/src/mgr/DaemonServer.cc +++ b/src/mgr/DaemonServer.cc @@ -1224,8 +1224,7 @@ bool DaemonServer::handle_command(MCommand *m) auto p = pg_map.osd_stat.find(osd); if (p == pg_map.osd_stat.end()) { missing_stats.insert(osd); - } - if (p->second.num_pgs > 0) { + } else if (p->second.num_pgs > 0) { stored_pgs.insert(osd); } }