[Lldb-commits] [lldb] r226366 - Commit fix for a static analyzer issue where a string pointer could theoretically be NULL..

Enrico Granata egranata at apple.com
Fri Jan 16 18:46:20 PST 2015


Author: enrico
Date: Fri Jan 16 20:46:20 2015
New Revision: 226366

URL: http://llvm.org/viewvc/llvm-project?rev=226366&view=rev
Log:
Commit fix for a static analyzer issue where a string pointer could theoretically be NULL..


Modified:
    lldb/trunk/source/DataFormatters/TypeSynthetic.cpp

Modified: lldb/trunk/source/DataFormatters/TypeSynthetic.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeSynthetic.cpp?rev=226366&r1=226365&r2=226366&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeSynthetic.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeSynthetic.cpp Fri Jan 16 20:46:20 2015
@@ -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;
 }





More information about the lldb-commits mailing list