Kaydet (Commit) 2206aaa7 authored tarafından Matteo Casalin's avatar Matteo Casalin

Loop only if string length is the desired one

Change-Id: I5e03fceb83a22b590a62b605c4ada279b937730a
üst 5b5b5818
...@@ -389,19 +389,21 @@ namespace dbaui ...@@ -389,19 +389,21 @@ namespace dbaui
void OTextConnectionHelper::SetSeparator( weld::ComboBox& rBox, const OUString& rList, const OUString& rVal ) 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}; const sal_Unicode nVal {rVal[0]};
OUString sTVal {static_cast< sal_Unicode >( rList.getToken(1, '\t', nIdx).toInt32() )}; for(sal_Int32 nIdx {0}; nIdx>=0;)
if( sTVal == rVal )
{ {
rBox.set_entry_text(rList.getToken(0, '\t', nPrevIdx)); sal_Int32 nPrevIdx {nIdx};
return; 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 );
} }
else if ( m_xTextSeparator.get() == &rBox && rVal.isEmpty() )
if ( m_xTextSeparator.get() == &rBox && rVal.isEmpty() )
rBox.set_entry_text(m_aTextNone); rBox.set_entry_text(m_aTextNone);
else else
rBox.set_entry_text(rVal.copy(0, 1)); rBox.set_entry_text(rVal.copy(0, 1));
......
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