From 0439f66742b3b71e2a36c79a09e0943e51a37bde Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Thu, 11 Sep 2014 18:44:37 +0200 Subject: [PATCH] xmlscript: avoid accessing [0] of an emptry string Change-Id: I2ad756b07418d3eb93f48374cd7de3bc3db9ce29 --- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index af40e4d51d65..3aed2223ef43 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx @@ -1064,7 +1064,11 @@ void TextFieldElement::endElement() if (getStringAttr( &aValue, "echochar", _xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !aValue.isEmpty() ) { SAL_WARN_IF( aValue.getLength() != 1, "xmlscript.xmldlg", "### more than one character given for echochar!" ); - sal_Int16 nChar = (sal_Int16)aValue[ 0 ]; + sal_Int16 nChar = 0; + if(!aValue.isEmpty()) + { + nChar = (sal_Int16)aValue[ 0 ]; + } xControlModel->setPropertyValue( "EchoChar", makeAny( nChar ) ); }