A bit of defensive code for an unreproducible bug.

Fixes https://gitlab.com/kicad/code/kicad/issues/4376
This commit is contained in:
Jeff Young 2020-05-09 14:14:00 +01:00
parent 19dc1f8b69
commit 935cab160b
1 changed files with 6 additions and 3 deletions

View File

@ -836,11 +836,14 @@ template<typename T>
static void moveNoFlagToVector( std::deque<T>& aList, std::vector<BOARD_ITEM*>& aTarget, bool aIsNew )
{
std::copy_if( aList.begin(), aList.end(), std::back_inserter( aTarget ),
[](T aItem)
[aIsNew]( T aItem )
{
bool retval = ( aItem->GetFlags() & FLAG0 ) == 0;
bool doCopy = ( aItem->GetFlags() & FLAG0 ) == 0;
aItem->ClearFlags( FLAG0 );
return retval;
aItem->SetFlags( aIsNew ? IS_NEW : 0 );
return doCopy;
} );
if( aIsNew )