Skip to content

Commit 3e21da8

Browse files
committedMay 1, 2020
Fix some labels incorrectly flagged as unplaced when they actually are placed
1 parent 985dba3 commit 3e21da8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎src/core/pal/problem.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,10 @@ QList<LabelPosition *> Problem::getSolution( bool returnInactive, QList<LabelPos
672672
}
673673
else if ( unlabeled )
674674
{
675-
if ( mFeatStartId[i] < static_cast< int >( mLabelPositions.size() ) )
676-
unlabeled->push_back( mLabelPositions[ mFeatStartId[i] ].get() );
675+
const int startPos = mFeatStartId[i];
676+
// need to be careful here -- if the next feature's start id is the same as this one, then this feature had no candidates!
677+
if ( startPos < static_cast< int >( mLabelPositions.size() ) && ( i == mFeatureCount - 1 || startPos != mFeatStartId[i + 1] ) )
678+
unlabeled->push_back( mLabelPositions[ startPos ].get() );
677679
}
678680
}
679681

0 commit comments

Comments
 (0)
Please sign in to comment.