Kaydet (Commit) efa52a41 authored tarafından Damjan Jovanovic's avatar Damjan Jovanovic

If called on an empty collection, don't let OEnumerationByIndex.nextElement()

call XIndexAccess.getByIndex() with an invalid index, just like
OEnumerationByName.nextElement() doesn't.

Patch by: me
üst 182d624d
...@@ -188,14 +188,13 @@ staruno::Any SAL_CALL OEnumerationByIndex::nextElement( ) ...@@ -188,14 +188,13 @@ staruno::Any SAL_CALL OEnumerationByIndex::nextElement( )
::osl::ResettableMutexGuard aLock(m_aLock); ::osl::ResettableMutexGuard aLock(m_aLock);
staruno::Any aRes; staruno::Any aRes;
if (m_xAccess.is()) if (m_xAccess.is() && m_nPos < m_xAccess->getCount())
{
aRes = m_xAccess->getByIndex(m_nPos++); aRes = m_xAccess->getByIndex(m_nPos++);
if (m_nPos >= m_xAccess->getCount())
{ if (m_xAccess.is() && m_nPos >= m_xAccess->getCount())
impl_stopDisposeListening(); {
m_xAccess.clear(); impl_stopDisposeListening();
} m_xAccess.clear();
} }
if (!aRes.hasValue()) // es gibt kein Element mehr if (!aRes.hasValue()) // es gibt kein Element mehr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment