diff --git a/src/Base/Parameter.cpp b/src/Base/Parameter.cpp index d6a392b550..57d1387c7a 100644 --- a/src/Base/Parameter.cpp +++ b/src/Base/Parameter.cpp @@ -1353,10 +1353,12 @@ void ParameterManager::SaveDocument(XMLFormatTarget* pFormatTarget) const // // do the serialization through DOMWriter::writeNode(); // - DOMLSOutput *theOutput = ((DOMImplementationLS*)impl)->createLSOutput(); - theOutput->setEncoding(gOutputEncoding); - theOutput->setByteStream(pFormatTarget); - theSerializer->write(_pDocument, theOutput); + if (_pDocument) { + DOMLSOutput *theOutput = ((DOMImplementationLS*)impl)->createLSOutput(); + theOutput->setEncoding(gOutputEncoding); + theOutput->setByteStream(pFormatTarget); + theSerializer->write(_pDocument, theOutput); + } delete theSerializer; }