summaryrefslogtreecommitdiffstats
path: root/svl/source/items/itemset.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svl/source/items/itemset.cxx')
-rw-r--r--svl/source/items/itemset.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 66780cb581..fd9cbb1ddd 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1891,11 +1891,8 @@ static void isMiss()
sal_uInt16 WhichRangesContainer::getOffsetFromWhich(sal_uInt16 nWhich) const
{
- if (empty())
- return INVALID_WHICHPAIR_OFFSET;
-
// special case for single entry - happens often e.g. UI stuff
- if (1 == m_size)
+ if (m_size == 1)
{
if( m_pairs->first <= nWhich && nWhich <= m_pairs->second )
return nWhich - m_pairs->first;
@@ -1904,6 +1901,9 @@ sal_uInt16 WhichRangesContainer::getOffsetFromWhich(sal_uInt16 nWhich) const
return INVALID_WHICHPAIR_OFFSET;
}
+ if (m_size == 0)
+ return INVALID_WHICHPAIR_OFFSET;
+
// check if nWhich is inside last successfully used WhichPair
if (INVALID_WHICHPAIR_OFFSET != m_aLastWhichPairOffset
&& m_aLastWhichPairFirst <= nWhich
@@ -1949,12 +1949,8 @@ sal_uInt16 WhichRangesContainer::getOffsetFromWhich(sal_uInt16 nWhich) const
sal_uInt16 WhichRangesContainer::getWhichFromOffset(sal_uInt16 nOffset) const
{
- // check for empty, if yes, return null which is an invalid WhichID
- if (empty())
- return 0;
-
// special case for single entry - happens often e.g. UI stuff
- if (1 == m_size)
+ if (m_size == 1)
{
if (nOffset <= m_pairs->second - m_pairs->first)
return m_pairs->first + nOffset;
@@ -1963,6 +1959,10 @@ sal_uInt16 WhichRangesContainer::getWhichFromOffset(sal_uInt16 nOffset) const
return 0;
}
+ // check for empty, if yes, return null which is an invalid WhichID
+ if (m_size == 0)
+ return 0;
+
// check if nWhich is inside last successfully used WhichPair
if (INVALID_WHICHPAIR_OFFSET != m_aLastWhichPairOffset)
{