pcbnew: Check for valid pointer before deref

In legacy toolkit, we do not keep the corner pointers, so dereferencing
causes crashes.

Fixes: lp:1808852
* https://bugs.launchpad.net/kicad/+bug/1808852

(cherry picked from commit 4aeef1e09e)
This commit is contained in:
Seth Hillbrand 2018-12-19 17:12:43 -07:00
parent 83d851956c
commit 8f7c073514
1 changed files with 4 additions and 2 deletions

View File

@ -206,8 +206,10 @@ public:
int GetSelectedCorner() const
{
// Transform relative indices to global index
int globalIndex;
m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
int globalIndex = -1;
if( m_CornerSelection )
m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
return globalIndex;
}