Permalink
Browse files

Fixed an issue where getting a position on an empty path caused a deb…

…ug breakpoint to trigger. This has been replaced with a proper exception.
  • Loading branch information...
1 parent 05280e4 commit 8616157f012ce51e65b199fe6ba5d76bbe804466 @paulhoux paulhoux committed May 4, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/cinder/Path2d.cpp
View
@@ -361,6 +361,9 @@ void Path2d::removeSegment( size_t segment )
Vec2f Path2d::getPosition( float t ) const
{
+ if( mPoints.empty() )
+ throw Path2dExc();
+
if( t <= 0 )
return mPoints[0];
else if( t >= 1 )
@@ -376,6 +379,9 @@ Vec2f Path2d::getPosition( float t ) const
Vec2f Path2d::getSegmentPosition( size_t segment, float t ) const
{
+ if( mSegments.empty() )
+ throw Path2dExc();
+
size_t firstPoint = 0;
for( size_t s = 0; s < segment; ++s )
firstPoint += sSegmentTypePointCounts[mSegments[s]];

0 comments on commit 8616157

Please sign in to comment.