Call verify_attached() from verify_in_transaction()

This commit is contained in:
Thomas Goyne 2016-02-03 09:28:11 -08:00
parent 27acf3f109
commit 8e58fc693c
1 changed files with 1 additions and 4 deletions

View File

@ -48,7 +48,6 @@ Row List::get(size_t row_ndx) const
void List::set(size_t row_ndx, size_t target_row_ndx) void List::set(size_t row_ndx, size_t target_row_ndx)
{ {
verify_attached();
verify_in_transaction(); verify_in_transaction();
verify_valid_row(row_ndx); verify_valid_row(row_ndx);
m_link_view->set(row_ndx, target_row_ndx); m_link_view->set(row_ndx, target_row_ndx);
@ -56,14 +55,12 @@ void List::set(size_t row_ndx, size_t target_row_ndx)
void List::add(size_t target_row_ndx) void List::add(size_t target_row_ndx)
{ {
verify_attached();
verify_in_transaction(); verify_in_transaction();
m_link_view->add(target_row_ndx); m_link_view->add(target_row_ndx);
} }
void List::insert(size_t row_ndx, size_t target_row_ndx) void List::insert(size_t row_ndx, size_t target_row_ndx)
{ {
verify_attached();
verify_in_transaction(); verify_in_transaction();
verify_valid_row(row_ndx, true); verify_valid_row(row_ndx, true);
m_link_view->insert(row_ndx, target_row_ndx); m_link_view->insert(row_ndx, target_row_ndx);
@ -71,7 +68,6 @@ void List::insert(size_t row_ndx, size_t target_row_ndx)
void List::remove(size_t row_ndx) void List::remove(size_t row_ndx)
{ {
verify_attached();
verify_in_transaction(); verify_in_transaction();
verify_valid_row(row_ndx); verify_valid_row(row_ndx);
m_link_view->remove(row_ndx); m_link_view->remove(row_ndx);
@ -102,6 +98,7 @@ void List::verify_attached() const
void List::verify_in_transaction() const void List::verify_in_transaction() const
{ {
verify_attached();
if (!m_realm->is_in_transaction()) { if (!m_realm->is_in_transaction()) {
throw std::runtime_error("Can only mutate a list within a transaction."); throw std::runtime_error("Can only mutate a list within a transaction.");
} }