Skip to content

Commit

Permalink
Fixing subtle Timeline::replaceTarget() bug courtesy of Sebastien Matte
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfb committed Feb 20, 2015
1 parent 7609f93 commit 7ba759c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/cinder/Timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,14 @@ void Timeline::cloneAndReplaceTarget( void *target, void *replacementTarget )

void Timeline::replaceTarget( void *target, void *replacementTarget )
{
if( target == 0 )
if( target == nullptr )
return;

pair<s_iter,s_iter> range = mItems.equal_range( target );
for( s_iter iter = range.first; iter != range.second; ) {
s_iter oldIter = iter;
++iter;
oldIter->second->setTarget( replacementTarget );
mItems.insert( make_pair( replacementTarget, oldIter->second ) );
mItems.erase( oldIter );
s_iter iter = mItems.find( target );
while( ( iter != mItems.end() ) && ( iter->first == target ) ) {
iter->second->setTarget( replacementTarget );
mItems.insert( make_pair( replacementTarget, iter->second ) );
iter = mItems.erase( iter );
}
}

Expand Down

0 comments on commit 7ba759c

Please sign in to comment.