Kaydet (Commit) 0cac63da authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

fix access to potentiellement empty string

Change-Id: I84fc6b7e5528b677411163ee3c9d05d4f2e6feb2
üst 0836415f
...@@ -122,13 +122,21 @@ bool cppu::nextDirectoryItem(osl::Directory & directory, rtl::OUString * url) { ...@@ -122,13 +122,21 @@ bool cppu::nextDirectoryItem(osl::Directory & directory, rtl::OUString * url) {
void cppu::decodeRdbUri(rtl::OUString * uri, bool * optional, bool * directory) void cppu::decodeRdbUri(rtl::OUString * uri, bool * optional, bool * directory)
{ {
assert(uri != 0 && optional != 0 && directory != 0); assert(uri != 0 && optional != 0 && directory != 0);
*optional = (*uri)[0] == '?'; if(!(uri->isEmpty()))
if (*optional) { {
*uri = uri->copy(1); *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(">*"); else
if (*directory) { {
*uri = uri->copy(1, uri->getLength() - 3); *optional = false;
*directory = false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment