[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sfx2/source

Bjoern Michaelsen bmichaelsen at kemper.freedesktop.org
Fri Apr 6 12:33:16 PDT 2012


 sfx2/source/dialog/filedlghelper.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit cac9cf690bf337a97ede781c38c5e7ddb3f37ca5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Apr 5 18:09:41 2012 +0200

    fdo#43895 lp#905355: fix the fix so it doesn't crash
    
    rtl::OUString rtl::OUString::copy(sal_Int32) const: Assertion
    `beginIndex >= 0 && beginIndex <= getLength()' failed.
    (regression from dd2fe95cce75f1157bd1c75d286a0047b2e4175e)
    
    Signed-off-by: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 79c1e4e..6acb006 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1654,8 +1654,17 @@ void FileDialogHelper_Impl::getRealFilter( String& _rFilter ) const
 void FileDialogHelper_Impl::verifyPath()
 {
 #ifdef UNX
+    static char const s_FileScheme[] = "file://";
+    if (0 != rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength(
+                maPath.getStr(), maPath.getLength(),
+                s_FileScheme, RTL_CONSTASCII_LENGTH(s_FileScheme)))
+    {
+        return;
+    }
+    const OString sFullPath = OUStringToOString(
+            maPath.copy(RTL_CONSTASCII_LENGTH(s_FileScheme)) + maFileName,
+            osl_getThreadTextEncoding() );
     struct stat aFileStat;
-    const OString sFullPath = OUStringToOString( maPath.copy(RTL_CONSTASCII_LENGTH("file://")) + maFileName, osl_getThreadTextEncoding() );
     stat( sFullPath.getStr(), &aFileStat );
     // lp#905355, fdo#43895
     // Check that the file has read only permission and is in /tmp -- this is


More information about the Libreoffice-commits mailing list