Fixed a crash when drawing a single point polyline

This commit is contained in:
Maciej Suminski 2016-09-29 15:34:08 +02:00
parent 904ae200e8
commit 7a5f72c948
1 changed files with 4 additions and 1 deletions

View File

@ -589,7 +589,7 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn
void OPENGL_GAL::DrawPolyline( const std::deque<VECTOR2D>& aPointList ) void OPENGL_GAL::DrawPolyline( const std::deque<VECTOR2D>& aPointList )
{ {
if( aPointList.empty() ) if( aPointList.size() < 2 )
return; return;
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
@ -617,6 +617,9 @@ void OPENGL_GAL::DrawPolyline( const std::deque<VECTOR2D>& aPointList )
void OPENGL_GAL::DrawPolyline( const VECTOR2D aPointList[], int aListSize ) void OPENGL_GAL::DrawPolyline( const VECTOR2D aPointList[], int aListSize )
{ {
if( aListSize < 2 )
return;
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
// Start from the second point // Start from the second point