Pcbnew: Allow rects to have overlapping end corner locations
CHANGED: If a rectangle is drawn and the location of the second corner is the same as another rectangle's second corner, Pcbnew crashes. The reason is that a call is made to DRAWSEGMENT::GetLength(), but that function only handles shapes of type S_CURVE and S_SEGMENT. This code checks if the overlapping end points are from a rectangle and if so it doesn't call DRAWSEGMENT::GetLength(). Fixes https://gitlab.com/kicad/code/kicad/issues/5282
This commit is contained in:
parent
441243753d
commit
29ddc73d6c
|
@ -1170,7 +1170,14 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, int aShape, DRAWSEGMEN
|
|||
|
||||
// If the user clicks on an existing snap point from a drawsegment
|
||||
// we finish the segment as they are likely closing a path
|
||||
if( snapItem && graphic->GetLength() > 0.0 )
|
||||
double graphicLength;
|
||||
|
||||
if( aShape != S_RECT )
|
||||
graphicLength = graphic->GetLength(); // Get actual length for non-rects
|
||||
else
|
||||
graphicLength = 1.0; // Set to 1.0 so conditional below succeeds for rects
|
||||
|
||||
if( snapItem && graphicLength > 0.0 )
|
||||
{
|
||||
commit.Add( graphic );
|
||||
commit.Push( _( "Draw a line segment" ) );
|
||||
|
|
Loading…
Reference in New Issue