From af3e0d751a2def9173a195fc79efc1b6b6b498bd Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Tue, 15 Oct 2013 19:19:40 +0800 Subject: [PATCH] Fixed a crash --- src/xercescatalogresolver.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/xercescatalogresolver.cpp b/src/xercescatalogresolver.cpp index 4c59734..3c346a3 100755 --- a/src/xercescatalogresolver.cpp +++ b/src/xercescatalogresolver.cpp @@ -69,7 +69,13 @@ InputSource *XercesCatalogResolver::resolveEntity ( #endif */ + if ( publicID == NULL || *publicID == '\0' ) + return NULL; + char *narrowPublicId = XMLString::transcode ( publicID ); + if ( narrowPublicId == NULL ) + return NULL; + std::string resolved; resolved = lookupPublicId ( narrowPublicId ); @@ -79,8 +85,8 @@ InputSource *XercesCatalogResolver::resolveEntity ( return NULL; XMLCh *wideResolved = XMLString::transcode ( resolved.c_str() ); - - InputSource *source = (InputSource *)new LocalFileInputSource ( wideResolved ); + + InputSource *source = (InputSource *)new LocalFileInputSource ( wideResolved ); XMLString::release ( &wideResolved ); return source;