[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.
This commit is contained in:
Walter Erquinigo 2023-09-06 17:49:12 -04:00 committed by GitHub
parent 508ad37648
commit 01c0a6a0a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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