Skip to content

Commit 87bd679

Browse files
authored
[lldb] Add null checks to childAtPath helper function (#2944)
Add conservative null checks to avoid expected input data. rdar://77286761
1 parent 9ed0f40 commit 87bd679

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeNames.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ enum class ThunkAction {
6060
static swift::Demangle::NodePointer
6161
childAtPath(swift::Demangle::NodePointer node,
6262
llvm::ArrayRef<swift::Demangle::Node::Kind> path) {
63-
if (path.empty())
63+
if (!node || path.empty())
6464
return node;
6565

6666
auto current_step = path.front();
6767
for (auto *child : *node)
68-
if (child->getKind() == current_step)
68+
if (child && child->getKind() == current_step)
6969
return childAtPath(child, path.drop_front());
7070
return nullptr;
7171
}

0 commit comments

Comments
 (0)