From 94e5443c05f3ed47d51465b91d5312a7d010b716 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Thu, 13 Sep 2018 21:13:16 +0200 Subject: Fix warning out-of-range value from the DatasourceType selection Fix warn:dbaccess.ui.generalpage:19437:19437:dbaccess/source/ui/dlg/generalpage.cxx:405: Got out-of-range value '2147483647' from the DatasourceType selection ListBox's GetSelectedEntryPos(): no corresponding URL prefix Just Launch Base and select "Open an existing database file" and see this log If there's nothing to display, we get 2147483647 which corresponds to LISTBOX_ENTRY_NOTFOUND Change-Id: Iaab680695d9816c6375d9ef04f02845890f99dda Reviewed-on: https://gerrit.libreoffice.org/60464 Reviewed-by: Lionel Elie Mamane Tested-by: Jenkins --- dbaccess/source/ui/dlg/generalpage.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'dbaccess') diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index 129583a7f8e3..e3efcaaedaf3 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -400,6 +400,8 @@ namespace dbaui { // get the type from the entry data const sal_Int32 nSelected = _rBox.GetSelectedEntryPos(); + if ( nSelected == LISTBOX_ENTRY_NOTFOUND) + return; if (static_cast(nSelected) >= m_aURLPrefixes.size() ) { SAL_WARN("dbaccess.ui.generalpage", "Got out-of-range value '" << nSelected << "' from the DatasourceType selection ListBox's GetSelectedEntryPos(): no corresponding URL prefix"); -- cgit