From 0eb05b47a6d89fdfc533515483584fc739962b65 Mon Sep 17 00:00:00 2001 From: Bayram Çiçek Date: Wed, 20 Sep 2023 14:37:08 +0300 Subject: tdf#49895: search in Options: check if label exists (related to tdf#157266) - since ids in ui files can be changed or removed, we have to check if they are exits or not, to prevent any crash or misbehavior. - Proper solution will be iterating over the widget ids and collecting their strings without based on a list of identifiers. Change-Id: I2088af6842ad0acd00838a37295dc2e6140096f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157103 Reviewed-by: Andreas Heinisch Tested-by: Andreas Heinisch --- cui/source/options/optaccessibility.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'cui/source/options/optaccessibility.cxx') diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx index e0667d51304d..f81c893673ca 100644 --- a/cui/source/options/optaccessibility.cxx +++ b/cui/source/options/optaccessibility.cxx @@ -54,13 +54,19 @@ OUString SvxAccessibilityOptionsTabPage::GetAllStrings() OUString labels[] = { "label1", "label2", "label13" }; for (const auto& label : labels) - sAllStrings += m_xBuilder->weld_label(label)->get_label() + " "; + { + if (const auto& pString = m_xBuilder->weld_label(label)) + sAllStrings += pString->get_label() + " "; + } OUString checkButton[] = { "acctool", "textselinreadonly", "animatedgraphics", "animatedtext", "autofontcolor", "systempagepreviewcolor" }; for (const auto& check : checkButton) - sAllStrings += m_xBuilder->weld_check_button(check)->get_label() + " "; + { + if (const auto& pString = m_xBuilder->weld_check_button(check)) + sAllStrings += pString->get_label() + " "; + } return sAllStrings.replaceAll("_", ""); } -- cgit