diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 6e1985b..3c0eef3 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -1928,11 +1928,13 @@ XMLError XMLDocument::Parse( const char* p, size_t len ) void XMLDocument::Print( XMLPrinter* streamer ) const { - XMLPrinter stdStreamer( stdout ); - if ( !streamer ) { - streamer = &stdStreamer; + if ( streamer ) { + Accept( streamer ); + } + else { + XMLPrinter stdoutStreamer( stdout ); + Accept( &stdoutStreamer ); } - Accept( streamer ); }