diff options
author | David Tardon <dtardon@redhat.com> | 2014-06-04 15:23:52 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-06-04 15:48:39 +0200 |
commit | 72d7d1f33bcddaddb5f8589418d0b20f5433845d (patch) | |
tree | 003ac67fc60e3c8e92e5785b9f4475f431250c95 /writerperfect | |
parent | 31ba2cb2fcb3b9466c553cf12d50bc6437ee826f (diff) |
ensure writerperfect::DirectoryStream only works for dirs
Change-Id: I588d295d72a600710324ee936d0c2291872c1d73
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/source/common/DirectoryStream.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/writerperfect/source/common/DirectoryStream.cxx b/writerperfect/source/common/DirectoryStream.cxx index e22e8066505d..a3522902cd8b 100644 --- a/writerperfect/source/common/DirectoryStream.cxx +++ b/writerperfect/source/common/DirectoryStream.cxx @@ -105,7 +105,7 @@ DirectoryStream::Impl::Impl(const uno::Reference<ucb::XContent> &rxContent) } DirectoryStream::DirectoryStream(const com::sun::star::uno::Reference<com::sun::star::ucb::XContent> &xContent) - : m_pImpl(new Impl(xContent)) + : m_pImpl(isDirectory(xContent) ? new Impl(xContent) : 0) { } @@ -155,6 +155,9 @@ catch (...) bool DirectoryStream::isStructured() { + if (!m_pImpl) + return false; + return true; } @@ -178,14 +181,15 @@ bool DirectoryStream::existsSubStream(const char * /* name */) librevenge::RVNGInputStream *DirectoryStream::getSubStreamByName(const char *const pName) { - librevenge::RVNGInputStream *input = 0; + if (!m_pImpl) + return 0; ucbhelper::Content aContent(m_pImpl->xContent, uno::Reference<ucb::XCommandEnvironment>(), comphelper::getProcessComponentContext()); const uno::Reference<io::XInputStream> xInputStream(findStream(aContent, rtl::OUString::createFromAscii(pName))); if (xInputStream.is()) - input = new WPXSvInputStream(xInputStream); + return new WPXSvInputStream(xInputStream); - return input; + return 0; } librevenge::RVNGInputStream *DirectoryStream::getSubStreamById(unsigned /* id */) |