Fix critical empty input bug in PrintVisitor