[lldb] Fix TestDataFormatterLibcxxString broken by D129490
We need to check for the error inside the value object to avoid reading
garbage through invalid (target) pointers.
GitOrigin-RevId: a72306e202eedaed7c1a25caf4565bf5577110ce
diff --git a/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index aaf3464..3b04b3a 100644
--- a/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -725,7 +725,7 @@
ExtractLibcxxStringInfo(ValueObject &valobj) {
ValueObjectSP valobj_r_sp =
valobj.GetChildMemberWithName(ConstString("__r_"), /*can_create=*/true);
- if (!valobj_r_sp)
+ if (!valobj_r_sp || !valobj_r_sp->GetError().Success())
return {};
// __r_ is a compressed_pair of the actual data and the allocator. The data we