libedit: Ensure proper dereference in shared tools

Fixes: lp:1829826
* https://bugs.launchpad.net/kicad/+bug/1829826
This commit is contained in:
Seth Hillbrand 2019-05-21 19:42:33 -07:00
parent b53b29399d
commit e1373d70ae
1 changed files with 7 additions and 1 deletions

View File

@ -604,7 +604,13 @@ SELECTION& EE_SELECTION_TOOL::RequestSelection( const KICAD_T aFilterList[] )
if( m_selection.Size() == 1 )
{
VECTOR2I refP = ((SCH_ITEM*) m_selection.GetItem( 0 ))->GetPosition();
VECTOR2I refP;
if( m_isLibEdit )
refP = static_cast<LIB_ITEM*>( m_selection.GetItem( 0 ) )->GetPosition();
else
refP = static_cast<SCH_ITEM*>( m_selection.GetItem( 0 ) )->GetPosition();
m_selection.SetReferencePoint( refP );
}