diff --git a/src/XmlConverterCiiToUbl.php b/src/XmlConverterCiiToUbl.php index e66001e..87676cd 100644 --- a/src/XmlConverterCiiToUbl.php +++ b/src/XmlConverterCiiToUbl.php @@ -70,6 +70,11 @@ protected function getDestinationNamespaces(): array protected function checkValidSource() { $invoiceElement = $this->source->query('//rsm:CrossIndustryInvoice')->item(0); + + if (is_null($invoiceElement)) { + throw new \RuntimeException('The document is not a valid CII document'); + } + $invoiceExchangeDocumentContext = $this->source->query('./rsm:ExchangedDocumentContext', $invoiceElement)->item(0); if (is_null($invoiceExchangeDocumentContext)) {