diff options
author | Bayram Çiçek <bayramcicek2125@gmail.com> | 2023-09-20 14:37:08 +0300 |
---|---|---|
committer | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2023-09-25 11:05:25 +0200 |
commit | 0eb05b47a6d89fdfc533515483584fc739962b65 (patch) | |
tree | a2a3d0e2708999e1865eb0ba56ecfb3836aa4f28 /sc/source/ui/optdlg/tpview.cxx | |
parent | a499a3f2486b44c8b1918e69490f9d26bdb0e1f5 (diff) |
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 <andreas.heinisch@yahoo.de>
Tested-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sc/source/ui/optdlg/tpview.cxx')
-rw-r--r-- | sc/source/ui/optdlg/tpview.cxx | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index 5bb4fc54c011..a31bc5d417fc 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -101,7 +101,10 @@ OUString ScTpContentOptions::GetAllStrings() "lbCursor", "label2", "objgrf_label", "diagram_label", "draw_label" }; 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[] = { "formula", "nil", "annot", "formulamark", "value", "anchor", @@ -109,7 +112,10 @@ OUString ScTpContentOptions::GetAllStrings() "cbSummary", "synczoom", "break", "guideline" }; 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("_", ""); } @@ -366,19 +372,28 @@ OUString ScTpLayoutOptions::GetAllStrings() OUString labels[] = { "label1", "label4", "label5", "label6", "label3" }; 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[] = { "aligncb", "editmodecb", "enter_paste_mode_cb", "formatcb", "exprefcb", "sortrefupdatecb", "markhdrcb", "replwarncb", "legacy_cell_selection_cb" }; 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() + " "; + } OUString radioButton[] = { "alwaysrb", "requestrb", "neverrb" }; for (const auto& radio : radioButton) - sAllStrings += m_xBuilder->weld_radio_button(radio)->get_label() + " "; + { + if (const auto& pString = m_xBuilder->weld_radio_button(radio)) + sAllStrings += pString->get_label() + " "; + } return sAllStrings.replaceAll("_", ""); } |