svx/source/accessibility/charmapacc.cxx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
New commits: commit 8d92140e10e3e05bdb0aa05eb7bfdbb68029aa7e Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Sep 5 09:07:35 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Sep 5 11:53:07 2022 +0200 cid#1513507 Dereference before null check and cid#1513511 Dereference before null check Change-Id: I58ec1fda9763c763c0e9cfbeeff4c623469c2135 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139403 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx index 9896262d615e..5b85a5e571cc 100644 --- a/svx/source/accessibility/charmapacc.cxx +++ b/svx/source/accessibility/charmapacc.cxx @@ -90,32 +90,33 @@ void SAL_CALL SvxShowCharSetAcc::disposing() m_pParent = nullptr; } - IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetAcc, OAccessibleSelectionHelper, OAccessibleHelper_Base ) IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetAcc, OAccessibleSelectionHelper, OAccessibleHelper_Base ) bool SvxShowCharSetAcc::implIsSelected( sal_Int64 nAccessibleChildIndex ) { + if (!m_pParent) + return false; + if (nAccessibleChildIndex < 0 || nAccessibleChildIndex >= getAccessibleChildCount()) throw IndexOutOfBoundsException(); - return m_pParent && m_pParent->IsSelected( - sal::static_int_cast<sal_uInt16>(nAccessibleChildIndex)); + return m_pParent->IsSelected(sal::static_int_cast<sal_uInt16>(nAccessibleChildIndex)); } - // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) +// select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) void SvxShowCharSetAcc::implSelect(sal_Int64 nAccessibleChildIndex, bool bSelect) { + if (!m_pParent) + return; + if (nAccessibleChildIndex < 0 || nAccessibleChildIndex >= getAccessibleChildCount()) throw IndexOutOfBoundsException(); - if ( m_pParent ) - { - if ( bSelect ) - m_pParent->SelectIndex(nAccessibleChildIndex, true); - else - m_pParent->DeSelect(); - } + if (bSelect) + m_pParent->SelectIndex(nAccessibleChildIndex, true); + else + m_pParent->DeSelect(); } css::awt::Rectangle SvxShowCharSetAcc::implGetBounds()