Author: Walter Erquinigo
Date: 2023-09-06T17:49:12-04:00
New Revision: 01c0a6a0a4c7f9101a35d2ab056191ecff117db5

URL: 
https://github.com/llvm/llvm-project/commit/01c0a6a0a4c7f9101a35d2ab056191ecff117db5
DIFF: 
https://github.com/llvm/llvm-project/commit/01c0a6a0a4c7f9101a35d2ab056191ecff117db5.diff

LOG: [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.

Added: 
    

Modified: 
    lldb/tools/lldb-vscode/JSONUtils.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-vscode/JSONUtils.cpp 
b/lldb/tools/lldb-vscode/JSONUtils.cpp
index 8cfe6dfeb667d8..9a6fd26d2bd586 100644
--- a/lldb/tools/lldb-vscode/JSONUtils.cpp
+++ b/lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -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.


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to