Bunch of cleanups for warnings found by the llvm static analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165808 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index 82f7cf3..6f77106 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -1227,7 +1227,7 @@
static void
DumpModuleUUID (Stream &strm, Module *module)
{
- if (module->GetUUID().IsValid())
+ if (module && module->GetUUID().IsValid())
module->GetUUID().Dump (&strm);
else
strm.PutCString(" ");
@@ -2720,8 +2720,14 @@
}
else
{
- module->GetFileSpec().GetPath (path, sizeof(path));
- result.AppendErrorWithFormat ("invalid module '%s'.\n", path);
+ FileSpec *module_spec_file = module_spec.GetFileSpecPtr();
+ if (module_spec_file)
+ {
+ module_spec_file->GetPath (path, sizeof(path));
+ result.AppendErrorWithFormat ("invalid module '%s'.\n", path);
+ }
+ else
+ result.AppendError ("no module spec");
result.SetStatus (eReturnStatusFailed);
}
}
@@ -3033,6 +3039,12 @@
PrintModule (Target *target, Module *module, uint32_t idx, int indent, Stream &strm)
{
+ if (module == NULL)
+ {
+ strm.PutCString("Null module");
+ return;
+ }
+
bool dump_object_name = false;
if (m_options.m_format_array.empty())
{