Skip to content

Commit

Permalink
Avoid infinite sort loop when gathering feature lists for the value r…
Browse files Browse the repository at this point in the history
…elation editor widget
  • Loading branch information
nirvn committed Dec 3, 2024
1 parent 52e2f84 commit 7f93da4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/core/featurelistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,16 +398,14 @@ void FeatureListModel::processFeatureList()
if ( mOrderByValue || !mGroupField.isEmpty() || !mSearchTerm.isEmpty() )
{
std::sort( entries.begin(), entries.end(), [=]( const Entry &entry1, const Entry &entry2 ) {
if ( entry1.key.isNull() )
if ( entry1.key.isNull() && !entry2.key.isNull() )
return true;

if ( entry2.key.isNull() )
if ( !entry1.key.isNull() && entry2.key.isNull() )
return false;

if ( !mGroupField.isEmpty() && entry1.group != entry2.group )
{
return entry1.group < entry2.group;
}

if ( !mSearchTerm.isEmpty() )
{
Expand Down

1 comment on commit 7f93da4

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.