summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xmlpatterns/schema/qxsdschemahelper.cpp2
-rw-r--r--src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/xmlpatterns/schema/qxsdschemahelper.cpp b/src/xmlpatterns/schema/qxsdschemahelper.cpp
index cdaa1c2..ce99ea7 100644
--- a/src/xmlpatterns/schema/qxsdschemahelper.cpp
+++ b/src/xmlpatterns/schema/qxsdschemahelper.cpp
@@ -518,7 +518,7 @@ bool XsdSchemaHelper::constructAndCompare(const DerivedString<TypeString>::Ptr &
const ReportContext::Ptr &context,
const SourceLocationReflection *const sourceLocationReflection)
{
- Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO,
+ Q_ASSERT_X(type && type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO,
"We can only compare atomic values.");
// we can not cast a xs:String to a xs:QName, so lets go the safe way
diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp
index 7e60667..de772e5 100644
--- a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp
+++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp
@@ -1113,6 +1113,7 @@ bool XsdValidatingInstanceReader::selectNodeSets(const XsdElement::Ptr&, const Q
const QXmlNodeModelIndex index = fieldItem.toNodeModelIndex();
const SchemaType::Ptr type = m_model->assignedType(index);
+ Q_ASSERT(type);
bool typeOk = true;
if (type->isComplexType()) {
@@ -1136,6 +1137,15 @@ bool XsdValidatingInstanceReader::selectNodeSets(const XsdElement::Ptr&, const Q
targetType = XsdSimpleType::Ptr(type)->primitiveType();
else
targetType = XsdComplexType::Ptr(type)->contentType()->simpleType();
+
+ if (!targetType) {
+ // QTBUG-77620: pattern type within a union doesn't get
+ // its primitive type set. FIXME: find root cause and
+ // fix that, so we can remove this (and an XFAIL).
+ error(QtXmlPatterns::tr("Field %1 is missing its simple type.")
+ .arg(formatData(field->expression())));
+ return false;
+ }
} else {
if (BuiltinTypes::xsAnySimpleType->name(m_namePool) == type->name(m_namePool)) {
targetType = BuiltinTypes::xsString;