parent is NULL error

Hi!
I'm always getting this error when trying to expand children of NULL pointer. But SBValue::GetChildrenCount() doesn't return zero.
It produces some trouble in our frontend: we are trying to be lazy and not discover value's children when it's not needed by user explicitly but we indicate that children are present since GetChildrenCount() != 0. Any workaround maybe?

Andrey Zaytsev
Software Developer at JetBrains, Inc
http://jetbrains.com
Develop with pleasure!

You can check if a value is a pointer using:

bool
SBValue::TypeIsPointerType ();

If you are using a more up to date LLDB that ha

value.GetType().IsPointerType();

Then you can check the pointer value to see if you really want to show the children. We will always return the number of children that a SBValue's type has even if the value is invalid because you might have expanded a pointer value before and the UI is remembering a user expansion state. The latest LLDB's also have a "get value as unsigned" convenience function:

    uint64_t
    SBValue::GetValueAsUnsigned(uint64_t fail_value=0);

so you could do something like:

if (value.TypeIsPointerType() && value.GetValueAsUnsigned() == 0)
{
    // NULL pointer....
}
else
{
}