From 1dfee884a61a60c687910e0d9222739edcec7684 Mon Sep 17 00:00:00 2001 From: Xinyi Zou Date: Thu, 26 Sep 2024 15:55:56 +0800 Subject: [PATCH] 3 --- be/src/util/runtime_profile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/be/src/util/runtime_profile.cpp b/be/src/util/runtime_profile.cpp index a784390ef63d27..fdcc0c0d573bf0 100644 --- a/be/src/util/runtime_profile.cpp +++ b/be/src/util/runtime_profile.cpp @@ -319,8 +319,8 @@ RuntimeProfile* RuntimeProfile::create_child(const std::string& name, bool inden if (_children.empty()) { add_child_unlock(child, indent, nullptr); } else { - ChildVector::iterator pos = prepend ? _children.begin() : _children.end(); - add_child_unlock(child, indent, (*pos).first); + auto* pos = prepend ? _children.begin()->first : nullptr; + add_child_unlock(child, indent, pos); } return child; } @@ -338,7 +338,7 @@ void RuntimeProfile::add_child_unlock(RuntimeProfile* child, bool indent, Runtim DCHECK(child != nullptr); _child_map[child->_name] = child; - if (loc == nullptr || loc == _children.end()->first) { + if (loc == nullptr) { _children.push_back(std::make_pair(child, indent)); } else { for (ChildVector::iterator it = _children.begin(); it != _children.end(); ++it) {