From 635bafe90f8347791fada2689f22643e78e595ab Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 1 Dec 2015 16:39:23 -0800 Subject: [PATCH] Update existing TableViews in first() and last() The call to update_tableview() was in the wrong place, resulting in it creating the table view, but not updating an existing one. --- results.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/results.cpp b/results.cpp index 215fcc3c..691e843d 100644 --- a/results.cpp +++ b/results.cpp @@ -108,9 +108,8 @@ util::Optional Results::first() case Mode::Table: return m_table->size() == 0 ? util::none : util::make_optional(m_table->front()); case Mode::Query: - update_tableview(); - REALM_FALLTHROUGH; case Mode::TableView: + update_tableview(); return m_table_view.size() == 0 ? util::none : util::make_optional(m_table_view.front()); } REALM_UNREACHABLE(); @@ -125,9 +124,8 @@ util::Optional Results::last() case Mode::Table: return m_table->size() == 0 ? util::none : util::make_optional(m_table->back()); case Mode::Query: - update_tableview(); - REALM_FALLTHROUGH; case Mode::TableView: + update_tableview(); return m_table_view.size() == 0 ? util::none : util::make_optional(m_table_view.back()); } REALM_UNREACHABLE();