summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xml/dom/qdom.cpp5
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 1fcbe607e4..9068830c4b 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -7035,6 +7035,9 @@ QDomNodeList QDomDocument::elementsByTagName(const QString& tagname) const
import QDomDocument and QDomDocumentType nodes. In those cases
this function returns a \l{QDomNode::isNull()}{null node}.
+ If \a importedNode is a \l{QDomNode::isNull()}{null node},
+ a null node is returned.
+
If \a deep is true, this function imports not only the node \a
importedNode but its whole subtree; if it is false, only the \a
importedNode is imported. The argument \a deep has no effect on
@@ -7093,6 +7096,8 @@ QDomNodeList QDomDocument::elementsByTagName(const QString& tagname) const
*/
QDomNode QDomDocument::importNode(const QDomNode& importedNode, bool deep)
{
+ if (importedNode.isNull())
+ return QDomNode();
if (!impl)
impl = new QDomDocumentPrivate();
return QDomNode(IMPL->importNode(importedNode.impl, deep));
diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp
index 20143b4ee1..80cf69b7fc 100644
--- a/tests/auto/xml/dom/qdom/tst_qdom.cpp
+++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp
@@ -718,6 +718,9 @@ void tst_QDom::ownerDocument()
OWNERDOCUMENT_IMPORTNODE_TEST( QDomEntityReference, doc2.createEntityReference( "foo" ) );
OWNERDOCUMENT_IMPORTNODE_TEST( QDomProcessingInstruction, doc2.createProcessingInstruction( "foo", "bar" ) );
OWNERDOCUMENT_IMPORTNODE_TEST( QDomText, doc2.createTextNode( "foo" ) );
+
+ // QTBUG-12927
+ QVERIFY(doc2.importNode(QDomNode(), deep).isNull());
}
}