diff --git a/src/QbXml/QbXml.csproj b/src/QbXml/QbXml.csproj index 915440c..24acf81 100644 --- a/src/QbXml/QbXml.csproj +++ b/src/QbXml/QbXml.csproj @@ -8,7 +8,7 @@ Jean-Sébastien Goupil Jean-Sébastien Goupil Copyright © Jean-Sébastien Goupil 2015-2021 - 3.0.1 + 3.0.2 QbSync.QbXml QbSync.QbXml QbSync.QbXml diff --git a/src/QbXml/QbXmlResponse.cs b/src/QbXml/QbXmlResponse.cs index 8b8b6ef..53e91cf 100644 --- a/src/QbXml/QbXmlResponse.cs +++ b/src/QbXml/QbXmlResponse.cs @@ -87,15 +87,18 @@ public IEnumerable GetItemsFromResponse(string response, System.Type typ private IEnumerable SearchFor(QBXML qbXml, System.Type type) { - foreach (var item in qbXml.Items) + if (qbXml.Items != null) { - if (item is QBXMLMsgsRs typedItem) + foreach (var item in qbXml.Items) { - foreach (var innerItem in typedItem.Items) + if (item is QBXMLMsgsRs typedItem && typedItem.Items != null) { - if (innerItem.GetType() == type || type.IsAssignableFrom(innerItem.GetType())) + foreach (var innerItem in typedItem.Items) { - yield return innerItem; + if (innerItem.GetType() == type || type.IsAssignableFrom(innerItem.GetType())) + { + yield return innerItem; + } } } } diff --git a/src/XsdGenerator/MemberEnhancer.cs b/src/XsdGenerator/MemberEnhancer.cs index 04978b4..fca365d 100644 --- a/src/XsdGenerator/MemberEnhancer.cs +++ b/src/XsdGenerator/MemberEnhancer.cs @@ -390,7 +390,7 @@ private XmlSchemaElement GetSchemaElement(XmlSchemaComplexType xmlSchemaComplexT .FirstOrDefault(m => m.QualifiedName?.Name == name); // Let's try to search in the choices. - if (xmlSchemaElementFound == null) + if (xmlSchemaElementFound == null && xmlSchemaSequence.Items != null) { foreach (var choice in xmlSchemaSequence.Items.OfType()) {