Skip to content

Commit 01c0a6a

Browse files
[lldb-vscode] Fix a GetChildAtIndex call (#65537)
We were invoking GetChildAtIndex(0) without checking the number of children. This was not crashing but was showing some warnings in python formatters.
1 parent 508ad37 commit 01c0a6a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lldb/tools/lldb-vscode/JSONUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ llvm::json::Value CreateVariable(lldb::SBValue v, int64_t variablesReference,
11331133
const auto num_children = v.GetNumChildren();
11341134
if (is_array) {
11351135
object.try_emplace("indexedVariables", num_children);
1136-
} else {
1136+
} else if (num_children > 0) {
11371137
// If a type has a synthetic child provider, then the SBType of "v" won't
11381138
// tell us anything about what might be displayed. So we can check if the
11391139
// first child's name is "[0]" and then we can say it is indexed.

0 commit comments

Comments
 (0)