Fix crash when duplicating an item in FP editor

Fixes: lp:1712828
* https://bugs.launchpad.net/kicad/+bug/1712828
This commit is contained in:
Maciej Suminski 2017-08-24 16:31:23 +02:00
parent 17b8342dc0
commit 7ce86e0da5
1 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2015 CERN
* Copyright (C) 2013-2017 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* Copyright (C) 2017 KiCad Developers, see CHANGELOG.TXT for contributors.
@ -313,7 +313,9 @@ bool EDIT_TOOL::invokeInlineRouter( int aDragMode )
if( track || via )
{
auto theRouter = static_cast<ROUTER_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
assert( theRouter );
if( !theRouter )
return false;
m_toolMgr->RunAction( PCB_ACTIONS::routerInlineDrag, true, aDragMode );
return true;
@ -322,14 +324,15 @@ bool EDIT_TOOL::invokeInlineRouter( int aDragMode )
return false;
}
bool EDIT_TOOL::isInteractiveDragEnabled() const
{
auto theRouter = static_cast<ROUTER_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
assert( theRouter );
return theRouter->Router()->Settings().InlineDragEnabled();
return theRouter ? theRouter->Router()->Settings().InlineDragEnabled() : false;
}
int EDIT_TOOL::Drag( const TOOL_EVENT& aEvent )
{
int mode = PNS::DM_ANY;