From b6a91e6d30e2a15880638d570d4c7d1e6c4a1853 Mon Sep 17 00:00:00 2001 From: Javier Fernandez Date: Thu, 6 Jun 2013 09:14:49 +0000 Subject: Prevent out-of-range values coming from ListBox GetSelectEntryPos. Change-Id: Ia787c412408ef53db3c8458f54c7843c669c81ad Reviewed-on: https://gerrit.libreoffice.org/4174 Reviewed-by: Lionel Elie Mamane Tested-by: Lionel Elie Mamane --- dbaccess/source/ui/dlg/generalpage.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'dbaccess') diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index 3eea60ae223c..037391641dfd 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -329,6 +329,11 @@ namespace dbaui { // get the type from the entry data sal_Int16 nSelected = _pBox->GetSelectEntryPos(); + if (nSelected < 0 || nSelected >= m_aURLPrefixes.size() ) + { + SAL_WARN("dbaui.OGeneralPage", "Got out-of-range value '" << nSelected << "' from the DatasourceType selection ListBox's GetSelectEntryPos(): " << ((nSelected < 0) ? "negative" : "no corresponding URL prefix") ); + return 0L; + } const OUString sURLPrefix = m_aURLPrefixes[ nSelected ]; setParentTitle( sURLPrefix ); -- cgit