Guard against NULL derefs.
authorJason Molenda <jmolenda@apple.com>
Thu, 16 Oct 2014 01:40:16 +0000 (01:40 +0000)
committerJason Molenda <jmolenda@apple.com>
Thu, 16 Oct 2014 01:40:16 +0000 (01:40 +0000)
clang static analyzer fixits.

llvm-svn: 219889

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

index b56dbc1..ec7b55b 100644 (file)
@@ -2990,7 +2990,7 @@ SymbolFileDWARF::ResolveSymbolContext(const FileSpec& file_spec, uint32_t line,
 
                                                     if (block_die != NULL)
                                                         sc.block = block.FindBlockByID (MakeUserID(block_die->GetOffset()));
-                                                    else
+                                                    else if (function_die != NULL)
                                                         sc.block = block.FindBlockByID (MakeUserID(function_die->GetOffset()));
                                                 }
                                             }
@@ -3402,7 +3402,7 @@ SymbolFileDWARF::ResolveFunction (DWARFCompileUnit *cu,
                 break;
         }
     }
-    assert (die->Tag() == DW_TAG_subprogram);
+    assert (die && die->Tag() == DW_TAG_subprogram);
     if (GetFunction (cu, die, sc))
     {
         Address addr;
@@ -7114,7 +7114,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
                 {
                     symbol_context_scope = sc.comp_unit;
                 }
-                else if (sc.function != NULL)
+                else if (sc.function != NULL && sc_parent_die)
                 {
                     symbol_context_scope = sc.function->GetBlock(true).FindBlockByID(MakeUserID(sc_parent_die->GetOffset()));
                     if (symbol_context_scope == NULL)