From 7ce86e0da5a746ea3b816a0de686e117418c2927 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 24 Aug 2017 16:31:23 +0200 Subject: [PATCH] Fix crash when duplicating an item in FP editor Fixes: lp:1712828 * https://bugs.launchpad.net/kicad/+bug/1712828 --- pcbnew/tools/edit_tool.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 8d4b5c3f04..b44c09bc44 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -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 * @author Tomasz Wlostowski * 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( 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( 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;