summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2012-06-01 11:42:53 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2012-06-01 17:01:52 +0200
commit76a74b72db45a5aa3f064034e0fa05440aefb52b (patch)
tree078ee4679bcbb7ee7b68c2247c7f492e99285080 /dbaccess
parentdf9ecb71c7b2622a082849b556dba5008d271b6a (diff)
fdo#50372: crash when refresh of last already-known row unexpectedly fails
Instead, try to do the least unreasonable thing: Fetch a new row If that fails because no new row to fetch, at least we are properly positioned after last row. Calling code may not expect that and get confused, but that is the best we can do. Change-Id: Ib7248e99ae3deee8344e9386cac2c9440e8bccd8
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/KeySet.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 7399cb5b32ee..c74cb23becda 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -1344,10 +1344,23 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
sal_Bool bOK = doTryRefetch_throw();
if ( !bOK )
{
+ // This row has disappeared; remove it.
OKeySetMatrix::iterator aTemp = m_aKeyIter;
+ // use *next* row
++m_aKeyIter;
m_aKeyMap.erase(aTemp);
- --m_rRowCount;
+
+ // adjust RowCount for the row we have removed
+ if (m_rRowCount > 0)
+ --m_rRowCount;
+ else
+ OSL_FAIL("m_rRowCount got out of sync: non-empty m_aKeyMap, but m_rRowCount <= 0");
+
+ if (!isAfterLast())
+ {
+ // it was the last row, but there may be another one to fetch
+ fetchRow();
+ }
refreshRow();
}
else