From 115d70e06076b7db7b1bbb6177edbb8b1c46cabb Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 29 Sep 2016 15:34:08 +0200 Subject: [PATCH] Fixed a crash when drawing a single point polyline --- common/gal/opengl/opengl_gal.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 1f2eab7e36..945161ff05 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -450,7 +450,7 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn void OPENGL_GAL::DrawPolyline( const std::deque& aPointList ) { - if( aPointList.empty() ) + if( aPointList.size() < 2 ) return; currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); @@ -478,6 +478,9 @@ void OPENGL_GAL::DrawPolyline( const std::deque& aPointList ) void OPENGL_GAL::DrawPolyline( const VECTOR2D aPointList[], int aListSize ) { + if( aListSize < 2 ) + return; + currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); // Start from the second point