]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crush/CrushWrapper: fix has_incompat_choose_args()
authorSage Weil <sage@redhat.com>
Tue, 23 May 2017 17:50:06 +0000 (13:50 -0400)
committerSage Weil <sage@redhat.com>
Tue, 23 May 2017 17:50:06 +0000 (13:50 -0400)
Special case empty and return false.  Otherwise the rest of the method
will dereference an invalid iterator on an empty choose_args
map.

Fixes broken fix in b1e4295570b6af4d844cf3ec55d77f5c287b29e6.

Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushWrapper.cc

index 14707f9a36e2ddf2862669657561c26212aeba09..a23b3cf6767caca11e2a2085b10694212eae406a 100644 (file)
@@ -112,6 +112,8 @@ bool CrushWrapper::has_choose_args() const
 
 bool CrushWrapper::has_incompat_choose_args() const
 {
+  if (choose_args.empty())
+    return false;
   if (choose_args.size() > 1)
     return true;
   crush_choose_arg_map arg_map = choose_args.begin()->second;