From bbe228404e65cd467832c8d9a5a434325aa7f957 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 25 Oct 2019 20:33:26 +0100 Subject: ensure id is valid before use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id0b5d07bbe3d2095858f9c3773d1acab3eac9636 Reviewed-on: https://gerrit.libreoffice.org/81532 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/source/ui/fldui/fldref.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 2c9064dbf8bc..a2c6bfb64244 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -372,7 +372,7 @@ IMPL_LINK_NOARG(SwFieldRefPage, TypeHdl, weld::TreeView&, void) switch (nTypeId) { case static_cast(SwFieldTypesEnum::GetRef): - if (REFFLDFLAG & m_xTypeLB->get_id(nOld).toUInt32()) + if (nOld != -1 && REFFLDFLAG & m_xTypeLB->get_id(nOld).toUInt32()) // the old one stays nFieldDlgFormatSel = m_xFormatLB->get_selected_index(); bName = true; -- cgit