summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2015-01-17 02:46:20 +0000
committerEnrico Granata <egranata@apple.com>2015-01-17 02:46:20 +0000
commit5b8cacdb5fc50aa0f7d6194303759349cfc095fa (patch)
treefbbdf2471750da98ed0c48fd849c0cc9aa771731
parent71e377d6eead9cf27bee1b1e3cf5d38175401e89 (diff)
downloadbcm5719-llvm-5b8cacdb5fc50aa0f7d6194303759349cfc095fa.tar.gz
bcm5719-llvm-5b8cacdb5fc50aa0f7d6194303759349cfc095fa.zip
Commit fix for a static analyzer issue where a string pointer could theoretically be NULL..
llvm-svn: 226366
-rw-r--r--lldb/source/DataFormatters/TypeSynthetic.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/lldb/source/DataFormatters/TypeSynthetic.cpp b/lldb/source/DataFormatters/TypeSynthetic.cpp
index 13c1c7508b6..b150b2bb6ee 100644
--- a/lldb/source/DataFormatters/TypeSynthetic.cpp
+++ b/lldb/source/DataFormatters/TypeSynthetic.cpp
@@ -68,18 +68,24 @@ size_t
TypeFilterImpl::FrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
const char* name_cstr = name.GetCString();
- for (size_t i = 0; i < filter->GetCount(); i++)
+ if (name_cstr)
{
- const char* expr_cstr = filter->GetExpressionPathAtIndex(i);
- if (expr_cstr)
+ for (size_t i = 0; i < filter->GetCount(); i++)
{
- if (*expr_cstr == '.')
- expr_cstr++;
- else if (*expr_cstr == '-' && *(expr_cstr+1) == '>')
- expr_cstr += 2;
+ const char* expr_cstr = filter->GetExpressionPathAtIndex(i);
+ if (expr_cstr)
+ {
+ if (*expr_cstr == '.')
+ expr_cstr++;
+ else if (*expr_cstr == '-' && *(expr_cstr+1) == '>')
+ expr_cstr += 2;
+ }
+ if (expr_cstr)
+ {
+ if (!::strcmp(name_cstr, expr_cstr))
+ return i;
+ }
}
- if (!::strcmp(name_cstr, expr_cstr))
- return i;
}
return UINT32_MAX;
}
OpenPOWER on IntegriCloud