From ddf0bb88cb4d414889bfdee29c615714d3287ec9 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 23 May 2017 13:50:06 -0400 Subject: [PATCH] crush/CrushWrapper: fix has_incompat_choose_args() 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 --- src/crush/CrushWrapper.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 14707f9a36e2d..a23b3cf6767ca 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -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; -- 2.39.5