diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-09-11 18:11:06 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-09-12 01:45:28 +0200 |
commit | 0cac63da2347afcc358ef9e24f1906614b4d2606 (patch) | |
tree | 85b0991bb34e7f49237120e4718bc6064e0adba1 /cppuhelper | |
parent | 0836415ffd592ecf932a1208f2faba70c2d4988d (diff) |
fix access to potentiellement empty string
Change-Id: I84fc6b7e5528b677411163ee3c9d05d4f2e6feb2
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/paths.cxx | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx index e8aa042218aa..c00d729a56bf 100644 --- a/cppuhelper/source/paths.cxx +++ b/cppuhelper/source/paths.cxx @@ -122,13 +122,21 @@ bool cppu::nextDirectoryItem(osl::Directory & directory, rtl::OUString * url) { void cppu::decodeRdbUri(rtl::OUString * uri, bool * optional, bool * directory) { assert(uri != 0 && optional != 0 && directory != 0); - *optional = (*uri)[0] == '?'; - if (*optional) { - *uri = uri->copy(1); + if(!(uri->isEmpty())) + { + *optional = (*uri)[0] == '?'; + if (*optional) { + *uri = uri->copy(1); + } + *directory = uri->startsWith("<") && uri->endsWith(">*"); + if (*directory) { + *uri = uri->copy(1, uri->getLength() - 3); + } } - *directory = uri->startsWith("<") && uri->endsWith(">*"); - if (*directory) { - *uri = uri->copy(1, uri->getLength() - 3); + else + { + *optional = false; + *directory = false; } } |