Wrapped some logging statements in conditionals, to prevent
crashes.
llvm-svn: 143756
diff --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp
index 783b873..2fc420f 100644
--- a/lldb/source/Symbol/ClangASTImporter.cpp
+++ b/lldb/source/Symbol/ClangASTImporter.cpp
@@ -49,10 +49,13 @@
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
- if (NamedDecl *named_decl = dyn_cast<NamedDecl>(decl))
- log->Printf(" [ClangASTImporter] WARNING: Failed to import a %s '%s'", decl->getDeclKindName(), named_decl->getNameAsString().c_str());
- else
- log->Printf(" [ClangASTImporter] WARNING: Failed to import a %s", decl->getDeclKindName());
+ if (log)
+ {
+ if (NamedDecl *named_decl = dyn_cast<NamedDecl>(decl))
+ log->Printf(" [ClangASTImporter] WARNING: Failed to import a %s '%s'", decl->getDeclKindName(), named_decl->getNameAsString().c_str());
+ else
+ log->Printf(" [ClangASTImporter] WARNING: Failed to import a %s", decl->getDeclKindName());
+ }
}
return result;