diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-11-09 19:54:57 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-11-10 22:04:07 +0100 |
commit | 2206aaa72cc678ab3f04ad318dc5049f580c8d09 (patch) | |
tree | a30bdb90fb5bfa49932acb6c9c4e6dd7f349b61d /dbaccess/source | |
parent | 5b5b58186eb197aac3898580317581dbabd71bdd (diff) |
Loop only if string length is the desired one
Change-Id: I5e03fceb83a22b590a62b605c4ada279b937730a
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/ui/dlg/TextConnectionHelper.cxx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 55c8e227eebb..6abb1cddb698 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -389,19 +389,21 @@ namespace dbaui void OTextConnectionHelper::SetSeparator( weld::ComboBox& rBox, const OUString& rList, const OUString& rVal ) { - for(sal_Int32 nIdx {0}; nIdx>=0;) + if (rVal.getLength()==1) { - sal_Int32 nPrevIdx {nIdx}; - OUString sTVal {static_cast< sal_Unicode >( rList.getToken(1, '\t', nIdx).toInt32() )}; - - if( sTVal == rVal ) + const sal_Unicode nVal {rVal[0]}; + for(sal_Int32 nIdx {0}; nIdx>=0;) { - rBox.set_entry_text(rList.getToken(0, '\t', nPrevIdx)); - return; + sal_Int32 nPrevIdx {nIdx}; + if (static_cast<sal_Unicode>(rList.getToken(1, '\t', nIdx).toInt32()) == nVal) + { + rBox.set_entry_text(rList.getToken(0, '\t', nPrevIdx)); + return; + } } + rBox.set_entry_text( rVal ); } - - if ( m_xTextSeparator.get() == &rBox && rVal.isEmpty() ) + else if ( m_xTextSeparator.get() == &rBox && rVal.isEmpty() ) rBox.set_entry_text(m_aTextNone); else rBox.set_entry_text(rVal.copy(0, 1)); |