diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-22 15:32:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-23 09:04:48 +0200 |
commit | ee6bdeec8d618f039e72d496dff44beb5b99abb2 (patch) | |
tree | eabd23b280c8a819137b3a2b22507ed8f1bfb858 /svtools/source/control | |
parent | a8622c77d26ca7a635afc95bba9a5054dc31eb7c (diff) |
loplugin:flatten in svl..svx
and implement a check in the plugin to prevent us modifying the
same patch of source code twice. This logic should probably be moved
into plugin.cxx at some point.
Change-Id: I7ebff6424cc8733bb2c8f7dba75eaaec68649290
Reviewed-on: https://gerrit.libreoffice.org/42660
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/source/control')
-rw-r--r-- | svtools/source/control/valueacc.cxx | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 467e704a2586..f1e145cc8e7a 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -176,14 +176,12 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessible { ThrowIfDisposed(); const SolarMutexGuard aSolarGuard; - uno::Reference< accessibility::XAccessible > xRet; ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(i)); - if( pItem ) - xRet = pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ ); - else + if( !pItem ) throw lang::IndexOutOfBoundsException(); + uno::Reference< accessibility::XAccessible > xRet = pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ ); return xRet; } @@ -489,13 +487,11 @@ void SAL_CALL ValueSetAcc::selectAccessibleChild( sal_Int32 nChildIndex ) const SolarMutexGuard aSolarGuard; ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex)); - if(pItem != nullptr) - { - mpParent->SelectItem( pItem->mnId ); - mpParent->Select (); - } - else + if(pItem == nullptr) throw lang::IndexOutOfBoundsException(); + + mpParent->SelectItem( pItem->mnId ); + mpParent->Select (); } @@ -504,13 +500,11 @@ sal_Bool SAL_CALL ValueSetAcc::isAccessibleChildSelected( sal_Int32 nChildIndex ThrowIfDisposed(); const SolarMutexGuard aSolarGuard; ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex)); - bool bRet = false; - if (pItem != nullptr) - bRet = mpParent->IsItemSelected( pItem->mnId ); - else + if (!(pItem != nullptr)) throw lang::IndexOutOfBoundsException(); + bool bRet = mpParent->IsItemSelected( pItem->mnId ); return bRet; } |