From d5689dd1aceec9daf9414808e9e3dfeaf3a753cf Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Thu, 30 Jan 2014 19:59:54 -0800 Subject: [PATCH] Fixed null pointer error --- astprinter.d | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/astprinter.d b/astprinter.d index 9b4031a..7454753 100644 --- a/astprinter.d +++ b/astprinter.d @@ -215,12 +215,18 @@ class XMLPrinter : ASTVisitor override void visit(CaseRangeStatement caseRangeStatement) { output.writeln(""); - output.writeln(""); - visit(caseRangeStatement.low); - output.writeln(""); - output.writeln(""); - visit(caseRangeStatement.high); - output.writeln(""); + if (caseRangeStatement.low !is null) + { + output.writeln(""); + visit(caseRangeStatement.low); + output.writeln(""); + } + if (caseRangeStatement.high !is null) + { + output.writeln(""); + visit(caseRangeStatement.high); + output.writeln(""); + } if (caseRangeStatement.declarationsAndStatements !is null) visit(caseRangeStatement.declarationsAndStatements); output.writeln(""); @@ -1329,12 +1335,14 @@ class XMLPrinter : ASTVisitor override void visit(Type2 type2) { - output.writeln(""); if (type2.builtinType != tok!"") - output.writeln(str(type2.builtinType)); + output.writeln("", str(type2.builtinType), ""); else + { + output.writeln(""); type2.accept(this); - output.writeln(""); + output.writeln(""); + } } override void visit(TypeSpecialization typeSpecialization)