diff --git a/include/SAX/wrappers/saxmsxml2.hpp b/include/SAX/wrappers/saxmsxml2.hpp index 8c262f11..ffbb3f39 100644 --- a/include/SAX/wrappers/saxmsxml2.hpp +++ b/include/SAX/wrappers/saxmsxml2.hpp @@ -683,6 +683,10 @@ class msxml2_wrapper : HRESULT hr = attributes_->getIndexFromName(wUri.data(), static_cast(wUri.length()), wLocalName.data(), static_cast(wLocalName.length()), &index); + if (FAILED(hr)) + { + index = -1; + } return index; } // getIndex @@ -690,7 +694,11 @@ class msxml2_wrapper : { int index = -1; std::wstring wQName(string_adaptor::asStdWString(qName)); - attributes_->getIndexFromQName(wQName.data(), static_cast(wQName.length()), &index); + HRESULT hr = attributes_->getIndexFromQName(wQName.data(), static_cast(wQName.length()), &index); + if (FAILED(hr)) + { + index = -1; + } return index; } // getIndex