Don't dereference null ptr if the transaction has 0 decls

git-svn-id: http://root.cern.ch/svn/root/trunk@46753 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
Vassil Vassilev 2012-10-24 07:34:53 +00:00
parent 88bd362c63
commit 09ca68c259

View File

@ -38,6 +38,9 @@ namespace cling {
}
void Transaction::dump() const {
if (!size())
return;
ASTContext& C = getFirstDecl().getSingleDecl()->getASTContext();
PrintingPolicy Policy = C.getPrintingPolicy();
Policy.DumpSourceManager = &C.getSourceManager();
@ -45,6 +48,9 @@ namespace cling {
}
void Transaction::dumpPretty() const {
if (!size())
return;
ASTContext& C = getFirstDecl().getSingleDecl()->getASTContext();
PrintingPolicy Policy(C.getLangOpts());
print(llvm::outs(), Policy, /*Indent*/0, /*PrintInstantiation*/true);