summaryrefslogtreecommitdiff
path: root/svx/source/gallery2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-12-17 10:23:30 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-12-17 10:24:06 +0000
commitc2f0845931b7cb1007d54173c2633c44123a137c (patch)
tree60cc0e2537df9b4e3458ca087e5b24fcfac2b1d4 /svx/source/gallery2
parentfc95037d1073224fb4143bb308cbdbc096aba774 (diff)
avoid negative offsets to OUString::copy
Change-Id: I0a62f8a38694a4a7662fe376aaabc35dca817d33
Diffstat (limited to 'svx/source/gallery2')
-rw-r--r--svx/source/gallery2/galmisc.cxx20
1 files changed, 16 insertions, 4 deletions
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
index b1214d5f96e4..fca950f8660f 100644
--- a/svx/source/gallery2/galmisc.cxx
+++ b/svx/source/gallery2/galmisc.cxx
@@ -199,10 +199,22 @@ OUString GetReducedString( const INetURLObject& rURL, sal_Int32 nMaxLen )
if( aPath.getLength() > nMaxLen )
{
- aReduced = aPath.copy( 0, nMaxLen - aName.getLength() - 4 );
- aReduced += "...";
- aReduced += OUString(aDelimiter);
- aReduced += aName;
+ sal_Int32 nPathPrefixLen = nMaxLen - aName.getLength() - 4;
+
+ if (nPathPrefixLen >= 0)
+ {
+ aReduced = aPath.copy(0, nPathPrefixLen);
+ aReduced += "...";
+ aReduced += OUString(aDelimiter);
+ aReduced += aName;
+ }
+ else
+ {
+ aReduced += "...";
+ aReduced += OUString(aDelimiter);
+ aReduced += "...";
+ aReduced += aName.copy( aName.getLength() - (nMaxLen - 7) );
+ }
}
else
aReduced = aPath;