[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Thu Dec 19 08:36:20 PST 2013
sc/source/ui/dbgui/scuiasciiopt.cxx | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
New commits:
commit d340d3bbcf12729adb2cd3a847bc474e3d58b286
Author: Eike Rathke <erack at redhat.com>
Date: Thu Dec 19 17:33:29 2013 +0100
check string length of file name before attempting to copy
File names CAN be shorter than 4 characters if they don't have a 3
character file name extension and the filter was selected.
Change-Id: Ic25bdf44cd44d48313c748525e75318e05240e8e
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 1cd49d6..6ecdcf6 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -292,11 +292,15 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,OUString aDatName,
bool bIsCSV = false;
bool bIsTSV = false;
- OUString aExtWithDot = aDatName.copy(aDatName.getLength() - 4); // All handled extensions (csv, tsv, tab) have length of 3
- if ( aExtWithDot.equalsIgnoreAsciiCase(".tsv") || aExtWithDot.equalsIgnoreAsciiCase(".tab") )
- bIsTSV = true;
- else if ( aExtWithDot.equalsIgnoreAsciiCase(".csv") )
- bIsCSV = true;
+ if (aDatName.getLength() >= 4)
+ {
+ // All handled extensions (csv, tsv, tab) have length of 3
+ OUString aExtWithDot = aDatName.copy(aDatName.getLength() - 4);
+ if ( aExtWithDot.equalsIgnoreAsciiCase(".tsv") || aExtWithDot.equalsIgnoreAsciiCase(".tab") )
+ bIsTSV = true;
+ else if ( aExtWithDot.equalsIgnoreAsciiCase(".csv") )
+ bIsCSV = true;
+ }
// Default options are set in officecfg/registry/schema/org/openoffice/Office/Calc.xcs
OUString sFieldSeparators(",;\t");
More information about the Libreoffice-commits
mailing list