From b4f4a70f604ddcb4e8e343aa0e690764fc46d780 Mon Sep 17 00:00:00 2001 From: Kevin Hendricks <kevin.b.hendricks@icloud.com> Date: Wed, 26 Jun 2019 19:04:35 -0400 Subject: [PATCH] try again to fix toX generated null pointer --- src/FlightCrew/Framework/ValidateEpub.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/FlightCrew/Framework/ValidateEpub.cpp b/src/FlightCrew/Framework/ValidateEpub.cpp index 80235a6..1353ce4 100644 --- a/src/FlightCrew/Framework/ValidateEpub.cpp +++ b/src/FlightCrew/Framework/ValidateEpub.cpp @@ -146,11 +146,14 @@ std::vector< fs::path > GetRelativePathsToXhtmlDocuments( const xc::DOMDocument std::string href = fromX( item->getAttribute( toX( "href" ) ) ); std::string media_type = fromX( item->getAttribute( toX( "media-type" ) ) ); - if ( xc::XMLUri::isValidURI( true, toX( href ) ) && - ( media_type == XHTML_MIME || media_type == OEB_DOC_MIME ) ) - { - paths.push_back( Util::Utf8PathToBoostPath( Util::UrlDecode( href ) ) ); - } + if (!href.empty()) { + + if ( xc::XMLUri::isValidURI( true, toX( href ) ) && + ( media_type == XHTML_MIME || media_type == OEB_DOC_MIME ) ) + { + paths.push_back( Util::Utf8PathToBoostPath( Util::UrlDecode( href ) ) ); + } + } } return paths;