Skip to content

Commit

Permalink
[gnc-tree-container.hpp] if the GtkTreeModel is empty, init m_iter wi…
Browse files Browse the repository at this point in the history
…th std::nullopt

Thus an empty container will evaluate begin()==end() as true.
  • Loading branch information
christopherlam committed Aug 18, 2023
1 parent 891e393 commit 1e44d1a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions gnucash/gnome-utils/gnc-tree-container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ class GncTreeIter
GncTreeIter(GtkTreeModel* model) : m_model (model)
{
GtkTreeIter iter;
gtk_tree_model_get_iter_first(m_model, &iter);
m_iter = iter;
m_iter = gtk_tree_model_get_iter_first(m_model, &iter) ? iter : std::nullopt;
}

GncTreeIter& operator++()
Expand Down

0 comments on commit 1e44d1a

Please sign in to comment.