Guard against children with nullptr ICorDebugValue
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Wed, 19 Jul 2017 20:25:10 +0000 (23:25 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Mon, 13 Nov 2017 19:22:40 +0000 (22:22 +0300)
src/debug/netcoredbg/varobj.cpp

index e06e1082a65d238675c9ad1519d019f36b3075cb..7898a7e9bc4d9ba632355468ac80d92508fa2162 100644 (file)
@@ -286,27 +286,30 @@ HRESULT ListChildren(
 
     std::vector<VarObjValue> members;
 
-    bool has_static_members;
-    bool has_more;
-
-    IfFailRet(FetchFieldsAndProperties(objValue.value,
-                                       NULL,
-                                       pThread,
-                                       pILFrame,
-                                       members,
-                                       objValue.statics_only,
-                                       has_static_members,
-                                       childStart,
-                                       childEnd,
-                                       has_more));
-
-    if (!objValue.statics_only && has_static_members)
+    bool has_static_members = false;
+    bool has_more = false;
+
+    if (objValue.value)
     {
-        objValue.value->AddRef();
-        members.emplace_back(objValue.threadId, objValue.value);
-    }
+        IfFailRet(FetchFieldsAndProperties(objValue.value,
+                                           NULL,
+                                           pThread,
+                                           pILFrame,
+                                           members,
+                                           objValue.statics_only,
+                                           has_static_members,
+                                           childStart,
+                                           childEnd,
+                                           has_more));
+
+        if (!objValue.statics_only && has_static_members)
+        {
+            objValue.value->AddRef();
+            members.emplace_back(objValue.threadId, objValue.value);
+        }
 
-    FixupInheritedFieldNames(members);
+        FixupInheritedFieldNames(members);
+    }
 
     PrintChildren(members, print_values, pILFrame, has_more, output);